Spaces:
Runtime error
Runtime error
victorisgeek
commited on
Commit
•
ec56523
1
Parent(s):
51aa4e6
Upload folder using huggingface_hub
Browse files- .Gitignore +135 -0
- LICENSE +21 -0
- README.md +30 -12
- data/auth.txt +1 -0
- data/data.txt +1 -0
- dependencies +11 -0
- lib/download.py +90 -0
- lib/getInfo.py +12 -0
- lib/getTTDict.py +16 -0
- lib/launcher.py +13 -0
- lib/sendT.py +29 -0
.Gitignore
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Byte-compiled / optimized / DLL files
|
2 |
+
__pycache__/
|
3 |
+
*.py[cod]
|
4 |
+
*$py.class
|
5 |
+
|
6 |
+
# C extensions
|
7 |
+
*.so
|
8 |
+
*.mp4
|
9 |
+
*.txt
|
10 |
+
*.jpg
|
11 |
+
*.png
|
12 |
+
# auth.txt
|
13 |
+
# ./data/data.txt
|
14 |
+
# Distribution / packaging
|
15 |
+
.Python
|
16 |
+
build/
|
17 |
+
develop-eggs/
|
18 |
+
dist/
|
19 |
+
downloads/
|
20 |
+
eggs/
|
21 |
+
.eggs/
|
22 |
+
lib64/
|
23 |
+
parts/
|
24 |
+
sdist/
|
25 |
+
var/
|
26 |
+
wheels/
|
27 |
+
pip-wheel-metadata/
|
28 |
+
share/python-wheels/
|
29 |
+
*.egg-info/
|
30 |
+
.installed.cfg
|
31 |
+
*.egg
|
32 |
+
MANIFEST
|
33 |
+
.vscode
|
34 |
+
|
35 |
+
|
36 |
+
# PyInstaller
|
37 |
+
# Usually these files are written by a python script from a template
|
38 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
39 |
+
*.manifest
|
40 |
+
*.spec
|
41 |
+
|
42 |
+
# Installer logs
|
43 |
+
pip-log.txt
|
44 |
+
pip-delete-this-directory.txt
|
45 |
+
|
46 |
+
# Unit test / coverage reports
|
47 |
+
htmlcov/
|
48 |
+
.tox/
|
49 |
+
.nox/
|
50 |
+
.coverage
|
51 |
+
.coverage.*
|
52 |
+
.cache
|
53 |
+
nosetests.xml
|
54 |
+
coverage.xml
|
55 |
+
*.cover
|
56 |
+
*.py,cover
|
57 |
+
.hypothesis/
|
58 |
+
.pytest_cache/
|
59 |
+
|
60 |
+
# Translations
|
61 |
+
*.mo
|
62 |
+
*.pot
|
63 |
+
|
64 |
+
# Django stuff:
|
65 |
+
*.log
|
66 |
+
local_settings.py
|
67 |
+
db.sqlite3
|
68 |
+
db.sqlite3-journal
|
69 |
+
|
70 |
+
# Flask stuff:
|
71 |
+
instance/
|
72 |
+
.webassets-cache
|
73 |
+
|
74 |
+
# Scrapy stuff:
|
75 |
+
.scrapy
|
76 |
+
|
77 |
+
# Sphinx documentation
|
78 |
+
docs/_build/
|
79 |
+
|
80 |
+
# PyBuilder
|
81 |
+
target/
|
82 |
+
|
83 |
+
# Jupyter Notebook
|
84 |
+
.ipynb_checkpoints
|
85 |
+
|
86 |
+
# IPython
|
87 |
+
profile_default/
|
88 |
+
ipython_config.py
|
89 |
+
|
90 |
+
# pyenv
|
91 |
+
.python-version
|
92 |
+
|
93 |
+
# pipenv
|
94 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
95 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
96 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
97 |
+
# install all needed dependencies.
|
98 |
+
#Pipfile.lock
|
99 |
+
|
100 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
101 |
+
__pypackages__/
|
102 |
+
|
103 |
+
# Celery stuff
|
104 |
+
celerybeat-schedule
|
105 |
+
celerybeat.pid
|
106 |
+
|
107 |
+
# SageMath parsed files
|
108 |
+
*.sage.py
|
109 |
+
|
110 |
+
# Environments
|
111 |
+
.env
|
112 |
+
.venv
|
113 |
+
env/
|
114 |
+
venv/
|
115 |
+
ENV/
|
116 |
+
env.bak/
|
117 |
+
venv.bak/
|
118 |
+
|
119 |
+
# Spyder project settings
|
120 |
+
.spyderproject
|
121 |
+
.spyproject
|
122 |
+
|
123 |
+
# Rope project settings
|
124 |
+
.ropeproject
|
125 |
+
|
126 |
+
# mkdocs documentation
|
127 |
+
/site
|
128 |
+
|
129 |
+
# mypy
|
130 |
+
.mypy_cache/
|
131 |
+
.dmypy.json
|
132 |
+
dmypy.json
|
133 |
+
|
134 |
+
# Pyre type checker
|
135 |
+
.pyre/
|
LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) 2022 Gio
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
README.md
CHANGED
@@ -1,12 +1,30 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# tiktok-and-instagram-content-stealer
|
2 |
+
|
3 |
+
this program allows you to save multiple videos or photos to your device from instagram and tiktok without a watermark and you have an option to send all these saved videos to the telegram channel of your choice.
|
4 |
+
|
5 |
+
## how to execute
|
6 |
+
|
7 |
+
##### step 0
|
8 |
+
|
9 |
+
download and install [Python](python.org)
|
10 |
+
|
11 |
+
##### step 1
|
12 |
+
|
13 |
+
install dependencies
|
14 |
+
```bash
|
15 |
+
pip install -r dependencies
|
16 |
+
```
|
17 |
+
##### step 2
|
18 |
+
|
19 |
+
input instagram and tiktok video/photo links in the **data.txt**
|
20 |
+
|
21 |
+
##### step 3
|
22 |
+
|
23 |
+
```bash
|
24 |
+
cd lib
|
25 |
+
python launcher.py
|
26 |
+
```
|
27 |
+
|
28 |
+
that's it!
|
29 |
+
|
30 |
+
if you want to send all the downloaded videos to the telegram channel of your choice, remove the comment from **sendTelmain()** in the **launcher.py**, add the link to your channel in the 13th line of **sendT.py** and add your api ID and hash in the **auth.txt**.
|
data/auth.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
|
data/data.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
|
dependencies
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
asyncio==3.4.3
|
2 |
+
certifi==2022.12.7
|
3 |
+
charset-normalizer==2.1.1
|
4 |
+
idna==3.4
|
5 |
+
instaloader==4.9.5
|
6 |
+
pyaes==1.6.1
|
7 |
+
pyasn1==0.4.8
|
8 |
+
requests==2.28.1
|
9 |
+
rsa==4.9
|
10 |
+
Telethon==1.26.1
|
11 |
+
urllib3==1.26.13
|
lib/download.py
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
from getTTDict import getDict
|
3 |
+
from getInfo import getLinkDict
|
4 |
+
import instaloader
|
5 |
+
|
6 |
+
def createHeader(parseDict) -> list:
|
7 |
+
|
8 |
+
cookies = {
|
9 |
+
'PHPSESSID': parseDict['PHPSESSID'],
|
10 |
+
# 'popCookie': parseDict['popCookie'],
|
11 |
+
}
|
12 |
+
headers = {
|
13 |
+
'authority': 'ttdownloader.com',
|
14 |
+
'accept': '*/*',
|
15 |
+
'accept-language': 'en-US,en;q=0.9',
|
16 |
+
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
17 |
+
'origin': 'https://ttdownloader.com',
|
18 |
+
'referer': 'https://ttdownloader.com/',
|
19 |
+
'sec-ch-ua': '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"',
|
20 |
+
'sec-ch-ua-mobile': '?0',
|
21 |
+
'sec-ch-ua-platform': '"Windows"',
|
22 |
+
'sec-fetch-dest': 'empty',
|
23 |
+
'sec-fetch-mode': 'cors',
|
24 |
+
'sec-fetch-site': 'same-origin',
|
25 |
+
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
|
26 |
+
'x-requested-with': 'XMLHttpRequest',
|
27 |
+
}
|
28 |
+
data = {
|
29 |
+
'url': '',
|
30 |
+
'format': '',
|
31 |
+
'token': parseDict['token'],
|
32 |
+
}
|
33 |
+
return cookies, headers, data
|
34 |
+
|
35 |
+
|
36 |
+
def TDL(cookies, headers, data, name) -> None:
|
37 |
+
response = requests.post('https://ttdownloader.com/search/',
|
38 |
+
cookies=cookies, headers=headers, data=data)
|
39 |
+
linkParse = [i for i in str(response.text).split()
|
40 |
+
if i.startswith("href=")][0]
|
41 |
+
|
42 |
+
response = requests.get(linkParse[6:-10])
|
43 |
+
with open("./vids/"+"tiktok"+name+".mp4", "wb") as f:
|
44 |
+
f.write(response.content)
|
45 |
+
|
46 |
+
|
47 |
+
def TDLALL() -> None:
|
48 |
+
parseDict = getDict()
|
49 |
+
cookies, headers, data = createHeader(parseDict)
|
50 |
+
linkList = getLinkDict()['tiktok']
|
51 |
+
for i in linkList:
|
52 |
+
try:
|
53 |
+
data['url'] = i
|
54 |
+
TDL(cookies, headers, data, str(linkList.index(i)))
|
55 |
+
except IndexError:
|
56 |
+
parseDict = getDict()
|
57 |
+
cookies, headers, data = createHeader(parseDict)
|
58 |
+
except Exception as err:
|
59 |
+
print(err)
|
60 |
+
exit(1)
|
61 |
+
|
62 |
+
|
63 |
+
def IDL(url,name) -> None:
|
64 |
+
obj = instaloader.Instaloader()
|
65 |
+
post = instaloader.Post.from_shortcode(obj.context, url.split('p/')[1].strip('/ '))
|
66 |
+
photo_url = post.url
|
67 |
+
video_url = post.video_url
|
68 |
+
if video_url:
|
69 |
+
response = requests.get(video_url)
|
70 |
+
with open("./vids/"+"insta"+name+".mp4", "wb") as f:
|
71 |
+
f.write(response.content)
|
72 |
+
elif photo_url:
|
73 |
+
response = requests.get(photo_url)
|
74 |
+
with open("./vids/"+"insta" +name+".jpg", "wb") as f:
|
75 |
+
f.write(response.content)
|
76 |
+
|
77 |
+
def IDLALL() -> None:
|
78 |
+
linkList = getLinkDict()['instagram']
|
79 |
+
for i in linkList:
|
80 |
+
try:
|
81 |
+
IDL(i,str(linkList.index(i)))
|
82 |
+
except Exception as err:
|
83 |
+
print(err)
|
84 |
+
exit(1)
|
85 |
+
|
86 |
+
|
87 |
+
if __name__ == "__main__":
|
88 |
+
# TDLALL()
|
89 |
+
# IDLALL()
|
90 |
+
pass
|
lib/getInfo.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
def getList()->list:
|
2 |
+
with open("../data/data.txt") as f: return [item.strip() for item in f.read().split('\n')]
|
3 |
+
|
4 |
+
def getLinkDict()->dict:
|
5 |
+
values={"tiktok":[],"instagram":[]}
|
6 |
+
for item in getList():
|
7 |
+
if item.startswith('https://www.instagram.com'):
|
8 |
+
values['instagram'].append(item)
|
9 |
+
elif item.startswith('https://www.tiktok.com') or item.startswith('https://m.tiktok.com'):
|
10 |
+
values['tiktok'].append(item)
|
11 |
+
return values
|
12 |
+
|
lib/getTTDict.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
|
3 |
+
|
4 |
+
def getDict() -> dict:
|
5 |
+
response = requests.get('https://ttdownloader.com/')
|
6 |
+
point = response.text.find('<input type="hidden" id="token" name="token" value="') + \
|
7 |
+
len('<input type="hidden" id="token" name="token" value="')
|
8 |
+
token = response.text[point:point+64]
|
9 |
+
TTDict = {
|
10 |
+
'token': token,
|
11 |
+
}
|
12 |
+
|
13 |
+
for i in response.cookies:
|
14 |
+
TTDict[str(i).split()[1].split('=')[0].strip()] = str(
|
15 |
+
i).split()[1].split('=')[1].strip()
|
16 |
+
return TTDict
|
lib/launcher.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from download import TDLALL
|
2 |
+
from download import IDLALL
|
3 |
+
from sendT import sendTelmain
|
4 |
+
|
5 |
+
|
6 |
+
|
7 |
+
def launch():
|
8 |
+
IDLALL()
|
9 |
+
TDLALL()
|
10 |
+
#sendTelmain()
|
11 |
+
|
12 |
+
if __name__ == '__main__':
|
13 |
+
launch()
|
lib/sendT.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from telethon import TelegramClient
|
2 |
+
import asyncio
|
3 |
+
import os
|
4 |
+
def op():
|
5 |
+
with open("../data/auth.txt") as f:
|
6 |
+
api_id = f.readline().strip()
|
7 |
+
api_hash = f.readline().strip()
|
8 |
+
return api_id, api_hash
|
9 |
+
|
10 |
+
async def sendTel():
|
11 |
+
api_id, api_hash = op()
|
12 |
+
async with TelegramClient('', api_id, api_hash) as client:
|
13 |
+
await client.connect()
|
14 |
+
channel = await client.get_entity('telegram channel link')
|
15 |
+
for video in os.listdir('./vids'):
|
16 |
+
await client.send_file(channel, './vids/'+video)
|
17 |
+
|
18 |
+
|
19 |
+
def sendTelmain():
|
20 |
+
try:
|
21 |
+
loop = asyncio.get_event_loop()
|
22 |
+
loop.run_until_complete(sendTel())
|
23 |
+
loop.close()
|
24 |
+
except Exception as err:
|
25 |
+
print(err)
|
26 |
+
exit(1)
|
27 |
+
|
28 |
+
if __name__ == '__main__':
|
29 |
+
print(op())
|