diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index a699535..ea44559 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -27,5 +27,6 @@ jobs: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | + ls tiktok_downloader/* python setup.py build sdist twine upload dist/* diff --git a/build/lib/tiktok_downloader/__init__.py b/build/lib/tiktok_downloader/__init__.py index 1d1b2d1..dc6b817 100644 --- a/build/lib/tiktok_downloader/__init__.py +++ b/build/lib/tiktok_downloader/__init__.py @@ -1,3 +1,5 @@ from .snaptik import snaptik from .ssstik import ssstik from .scrapper import info_post +from .tikmate import tikmate +from .mdown import mdown \ No newline at end of file diff --git a/build/lib/tiktok_downloader/mdown.py b/build/lib/tiktok_downloader/mdown.py new file mode 100644 index 0000000..0828c33 --- /dev/null +++ b/build/lib/tiktok_downloader/mdown.py @@ -0,0 +1,17 @@ +from bs4 import BeautifulSoup +import requests +from requests.models import InvalidURL +from .utils import info_videotiktok +class mdown(requests.Session): + BASE_URL='https://musicaldown.com/' + def __init__(self) -> None: + super().__init__() + self.headers={"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36"} + def get_media(self, url): + bs=BeautifulSoup(self.get(self.BASE_URL).text,'html.parser') + form = {i['name']:i['value'] for i in bs.find_all('input', attrs={'type':'hidden'})} + form.update({bs.find('input', attrs={'type':'text'})['name']:url}) + res=self.post(f'{self.BASE_URL}download', data=form, headers={"origin": "https://musicaldown.com","referer": "https://musicaldown.com/en/","sec-ch-ua": '"Chromium";v="94", "Google Chrome";v="94", ";Not A Brand";v="99"',"sec-ch-ua-mobile": "?0","sec-ch-ua-platform": "Linux","sec-fetch-dest": "document","sec-fetch-mode": "navigate","sec-fetch-site": "same-origin","sec-fetch-user": "?1","upgrade-insecure-requests": "1","user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36"}) + if 'err' in res.url: + raise InvalidURL() + return [info_videotiktok(i['href'], self) for i in BeautifulSoup(res.text,'html.parser').find_all('a', attrs={'target':'_blank'})] \ No newline at end of file diff --git a/build/lib/tiktok_downloader/scrapper.py b/build/lib/tiktok_downloader/scrapper.py index 09a985d..849f919 100644 --- a/build/lib/tiktok_downloader/scrapper.py +++ b/build/lib/tiktok_downloader/scrapper.py @@ -1,11 +1,7 @@ -from requests import Session import requests, json from datetime import datetime -from bs4 import BeautifulSoup import re from tiktok_downloader.Except import InvalidUrl -from tiktok_downloader.keeptiktok import keeptiktok -from tiktok_downloader.utils import info_videotiktok class info_post(requests.Session): ''' :param url: video url(tiktok) diff --git a/build/lib/tiktok_downloader/server.py b/build/lib/tiktok_downloader/server.py index af7dfec..ea71db9 100644 --- a/build/lib/tiktok_downloader/server.py +++ b/build/lib/tiktok_downloader/server.py @@ -1,5 +1,6 @@ +from tiktok_downloader.mdown import mdown from flask import Flask, request,render_template -from . import info_post, snaptik, ssstik +from . import info_post, snaptik, ssstik, tikmate import json, os app = Flask(__name__, template_folder=os.path.abspath(__file__+'/../templates'), static_folder=os.path.abspath(__file__+'/../static')) @app.route('/') @@ -53,12 +54,20 @@ def snapt(path): return json.dumps({ 'msg':'url tidak valid' }) - elif path not in ['snaptik', 'ssstik']: + elif path not in ['snaptik', 'ssstik', 'tikmate','mdown']: return json.dumps({'msg':'path tidak ditemukan'}) if request.args.get('url'): try: - ok=snaptik(request.args['url']).get_media() if path == 'snaptik' else ssstik().get_media(request.args['url']) - return json.dumps([{'type':i.type,'url':i.json} for i in ok],indent=4) + res=[] + if path == 'snaptik': + res = snaptik(request.args['url']).get_media() + elif path =='ssstik': + res = ssstik().get_media(request.args['url']) + elif path == 'tikmate': + res = tikmate().get_media(request.args['url']) + elif path == 'mdown': + res = mdown().get_media(request.args['url']) + return json.dumps([{'type':i.type,'url':i.json} for i in res],indent=4) except Exception as e: print(e) return json.dumps({ diff --git a/build/lib/tiktok_downloader/tikmate.py b/build/lib/tiktok_downloader/tikmate.py new file mode 100644 index 0000000..125d083 --- /dev/null +++ b/build/lib/tiktok_downloader/tikmate.py @@ -0,0 +1,20 @@ +from requests.models import InvalidURL +from . import snaptik +from .utils import info_videotiktok +from ast import literal_eval +import re +import requests +class tikmate(requests.Session): + BASE_URL='https://tikmate.online/' + def __init__(self) -> None: + super().__init__() + self.headers={'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36'} + def get_media(self, url): + token = re.search('name\=\"token\".*?value\=\"(.*?)\"',self.get(self.BASE_URL).text).group(1) + media = self.post(self.BASE_URL+'abc.php', data={'url':url, 'token':token},headers={"origin": "https://tikmate.online","referer": "https://tikmate.online/","sec-ch-ua": '"Chromium";v="94", "Google Chrome";v="94", ";Not A Brand";v="99"',"sec-ch-ua-mobile": "?0","sec-ch-ua-platform": "Linux","sec-fetch-dest": "iframe","sec-fetch-mode": "navigate","sec-fetch-site": "same-origin","sec-fetch-user": "?1","upgrade-insecure-requests": "1","user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36"}) + if "'error_api_get'" in media.text: + raise InvalidURL() + tt=re.findall(r'\(\".*?,.*?,.*?,.*?,.*?.*?\)',media.text) + d=literal_eval(tt[0]).__str__() + decode = snaptik.decoder.eval(f'decoder{d}') + return [info_videotiktok(self.BASE_URL+x, self) for x in re.findall('(download.php\?token.*?)\\\\\"',decode)] \ No newline at end of file diff --git a/tiktok_downloader.egg-info/PKG-INFO b/tiktok_downloader.egg-info/PKG-INFO index 37b6b18..29b43d9 100644 --- a/tiktok_downloader.egg-info/PKG-INFO +++ b/tiktok_downloader.egg-info/PKG-INFO @@ -1,4 +1,4 @@ -Metadata-Version: 2.1 +Metadata-Version: 1.1 Name: tiktok-downloader Version: 0.1.6 Summary: Tiktok Downloader&Scraper using bs4&requests @@ -7,6 +7,7 @@ Author: Krypton Byte Author-email: galaxyvplus6434@gmail.com License: MIT Download-URL: https://codeload.github.com/krypton-byte/tiktok-downloader/tar.gz/refs/tags/0.1.6 +Description: UNKNOWN Keywords: tiktok,downloader,scrapper,tikdok-scraper,tiktok-downloader Platform: UNKNOWN Classifier: Development Status :: 3 - Alpha @@ -15,6 +16,3 @@ Classifier: Topic :: Software Development :: Build Tools Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 - -UNKNOWN - diff --git a/tiktok_downloader.egg-info/SOURCES.txt b/tiktok_downloader.egg-info/SOURCES.txt index c5a322a..c000389 100644 --- a/tiktok_downloader.egg-info/SOURCES.txt +++ b/tiktok_downloader.egg-info/SOURCES.txt @@ -4,12 +4,13 @@ setup.py tiktok_downloader/Except.py tiktok_downloader/__init__.py tiktok_downloader/__main__.py -tiktok_downloader/keeptiktok.py +tiktok_downloader/mdown.py tiktok_downloader/scrapper.py tiktok_downloader/server.py tiktok_downloader/snaptik.py tiktok_downloader/ssstik.py tiktok_downloader/test.py +tiktok_downloader/tikmate.py tiktok_downloader/utils.py tiktok_downloader.egg-info/PKG-INFO tiktok_downloader.egg-info/SOURCES.txt diff --git a/tiktok_downloader.egg-info/requires.txt b/tiktok_downloader.egg-info/requires.txt index fede16a..413acf7 100644 --- a/tiktok_downloader.egg-info/requires.txt +++ b/tiktok_downloader.egg-info/requires.txt @@ -1,5 +1,5 @@ bs4 -flask cloudscraper -requests +flask py-mini-racer +requests