Skip to content

Commit

Permalink
fake ip
Browse files Browse the repository at this point in the history
  • Loading branch information
krypton-byte committed Oct 22, 2021
1 parent 9cdc206 commit 24a730f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'flask',
'cloudscraper',
'requests',
'faker',
'py-mini-racer'
],
classifiers=[
Expand Down
Binary file modified tiktok_downloader/__pycache__/scrapper.cpython-39.pyc
Binary file not shown.
5 changes: 4 additions & 1 deletion tiktok_downloader/scrapper.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import faker
import requests, json
from datetime import datetime
import re
from tiktok_downloader.Except import InvalidUrl
from faker import Faker
fake = Faker()
class info_post(requests.Session):
'''
:param url: video url(tiktok)
'''
def __init__(self, url: str) -> None:
super().__init__()
self.headers={"sec-ch-ua": '"Google Chrome";v="89", "Chromium";v="89", ";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": "none","sec-fetch-user": "?1","upgrade-insecure-requests": "1","user-agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"}
self.headers={"sec-ch-ua": '"Google Chrome";v="89", "Chromium";v="89", ";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": "none","sec-fetch-user": "?1","upgrade-insecure-requests": "1","user-agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36", "X-Forwarded-For":fake.ipv4()}
self.html = self.get(url)
self.js = json.loads(re.search(r'\>(\{\"props\":.*?)\<\/script>',self.html.text).group(1))
self.account = Account(self.js['props']['pageProps']['itemInfo']['itemStruct']['author'])
Expand Down

0 comments on commit 24a730f

Please sign in to comment.