Skip to content

Commit

Permalink
add support for x.com links
Browse files Browse the repository at this point in the history
  • Loading branch information
gpchelkin committed Aug 20, 2023
1 parent 88d763c commit 56c87cd
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 55 deletions.
77 changes: 38 additions & 39 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ safety = "^2.3"
optional = true

[tool.poetry.group.docs.dependencies]
sphinx = "^7.1"
sphinx = "^7.2"
sphinx-autodoc-typehints = "^1.24"
m2r2 = "^0.3"
tomli = "^2.0"
Expand Down
6 changes: 3 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ black==23.7.0 ; python_version >= "3.9" and python_version < "4.0"
cattrs==23.1.2 ; python_version >= "3.9" and python_version < "4.0"
certifi==2023.7.22 ; python_version >= "3.9" and python_version < "4.0"
charset-normalizer==3.2.0 ; python_version >= "3.9" and python_version < "4.0"
click==8.1.6 ; python_version >= "3.9" and python_version < "4.0"
click==8.1.7 ; python_version >= "3.9" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.9" and python_version < "4.0" and (platform_system == "Windows" or sys_platform == "win32")
configupdater==3.1.1 ; python_version >= "3.9" and python_version < "4.0"
darglint==1.8.1 ; python_version >= "3.9" and python_version < "4.0"
Expand All @@ -16,7 +16,7 @@ docutils==0.20.1 ; python_version >= "3.9" and python_version < "4.0"
dparse==0.6.3 ; python_version >= "3.9" and python_version < "4.0"
dpath==2.1.6 ; python_version >= "3.9" and python_version < "4.0"
eradicate==2.3.0 ; python_version >= "3.9" and python_version < "4.0"
exceptiongroup==1.1.2 ; python_version >= "3.9" and python_version < "3.11"
exceptiongroup==1.1.3 ; python_version >= "3.9" and python_version < "3.11"
flake8-bandit==4.1.1 ; python_version >= "3.9" and python_version < "4.0"
flake8-broken-line==1.0.0 ; python_version >= "3.9" and python_version < "4.0"
flake8-bugbear==23.7.10 ; python_version >= "3.9" and python_version < "4.0"
Expand Down Expand Up @@ -67,7 +67,7 @@ rich==13.5.2 ; python_version >= "3.9" and python_version < "4.0"
ruamel-yaml-clib==0.2.7 ; platform_python_implementation == "CPython" and python_version < "3.12" and python_version >= "3.9"
ruamel-yaml==0.17.32 ; python_version >= "3.9" and python_version < "4.0"
safety==2.3.4 ; python_version >= "3.9" and python_version < "4.0"
setuptools==68.0.0 ; python_version >= "3.9" and python_version < "4.0"
setuptools==68.1.2 ; python_version >= "3.9" and python_version < "4.0"
six==1.16.0 ; python_version >= "3.9" and python_version < "4.0"
smmap==5.0.0 ; python_version >= "3.9" and python_version < "4.0"
snowballstemmer==2.2.0 ; python_version >= "3.9" and python_version < "4.0"
Expand Down
12 changes: 6 additions & 6 deletions requirements-docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ recommonmark==0.7.1 ; python_version >= "3.9" and python_version < "4.0"
requests==2.31.0 ; python_version >= "3.9" and python_version < "4.0"
snowballstemmer==2.2.0 ; python_version >= "3.9" and python_version < "4.0"
sphinx-autodoc-typehints==1.24.0 ; python_version >= "3.9" and python_version < "4.0"
sphinx==7.1.2 ; python_version >= "3.9" and python_version < "4.0"
sphinxcontrib-applehelp==1.0.6 ; python_version >= "3.9" and python_version < "4.0"
sphinxcontrib-devhelp==1.0.4 ; python_version >= "3.9" and python_version < "4.0"
sphinxcontrib-htmlhelp==2.0.3 ; python_version >= "3.9" and python_version < "4.0"
sphinx==7.2.2 ; python_version >= "3.9" and python_version < "4.0"
sphinxcontrib-applehelp==1.0.7 ; python_version >= "3.9" and python_version < "4.0"
sphinxcontrib-devhelp==1.0.5 ; python_version >= "3.9" and python_version < "4.0"
sphinxcontrib-htmlhelp==2.0.4 ; python_version >= "3.9" and python_version < "4.0"
sphinxcontrib-jsmath==1.0.1 ; python_version >= "3.9" and python_version < "4.0"
sphinxcontrib-qthelp==1.0.5 ; python_version >= "3.9" and python_version < "4.0"
sphinxcontrib-serializinghtml==1.1.7 ; python_version >= "3.9" and python_version < "4.0"
sphinxcontrib-qthelp==1.0.6 ; python_version >= "3.9" and python_version < "4.0"
sphinxcontrib-serializinghtml==1.1.8 ; python_version >= "3.9" and python_version < "4.0"
tomli==2.0.1 ; python_version >= "3.9" and python_version < "4.0"
typing-extensions==4.7.1 ; python_version >= "3.9" and python_version < "4.0"
urllib3==2.0.4 ; python_version >= "3.9" and python_version < "4.0"
Expand Down
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
anyio==3.7.1 ; python_version >= "3.9" and python_version < "4.0"
apscheduler==3.10.1 ; python_version >= "3.9" and python_version < "4.0"
apscheduler==3.10.4 ; python_version >= "3.9" and python_version < "4.0"
args==0.1.0 ; python_version >= "3.9" and python_version < "4.0"
bandcamp-downloader==0.0.13 ; python_version >= "3.9" and python_version < "4.0"
beautifulsoup4==4.12.2 ; python_version >= "3.9" and python_version < "4.0"
Expand All @@ -14,7 +14,7 @@ clint==0.5.1 ; python_version >= "3.9" and python_version < "4.0"
dacite==1.8.1 ; python_version >= "3.9" and python_version < "4.0"
demjson3==3.0.6 ; python_version >= "3.9" and python_version < "4.0"
docopt==0.6.2 ; python_version >= "3.9" and python_version < "4.0"
exceptiongroup==1.1.2 ; python_version >= "3.9" and python_version < "3.11"
exceptiongroup==1.1.3 ; python_version >= "3.9" and python_version < "3.11"
fake-useragent==1.2.1 ; python_version >= "3.9" and python_version < "4.0"
ffmpeg-python==0.2.0 ; python_version >= "3.9" and python_version < "4.0"
future==0.18.3 ; python_version >= "3.9" and python_version < "4.0"
Expand Down Expand Up @@ -44,7 +44,6 @@ requests==2.31.0 ; python_version >= "3.9" and python_version < "4.0"
requests[socks]==2.31.0 ; python_version >= "3.9" and python_version < "4.0"
scdl==2.7.3 ; python_version >= "3.9" and python_version < "4.0"
sdnotify==0.3.2 ; python_version >= "3.9" and python_version < "4.0"
setuptools==68.0.0 ; python_version >= "3.9" and python_version < "4.0"
six==1.16.0 ; python_version >= "3.9" and python_version < "4.0"
sniffio==1.3.0 ; python_version >= "3.9" and python_version < "4.0"
soundcloud-v2==1.3.1 ; python_version >= "3.9" and python_version < "4.0"
Expand Down
7 changes: 4 additions & 3 deletions scdlbot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ def get_response_text(file_name):
DOMAIN_TT = "tiktok.com"
DOMAIN_IG = "instagram.com"
DOMAIN_TW = "twitter.com"
DOMAINS = [DOMAIN_SC, DOMAIN_SC_API, DOMAIN_BC, DOMAIN_YT, DOMAIN_YT_BE, DOMAIN_TT, DOMAIN_IG, DOMAIN_TW]
DOMAIN_TWX = "x.com"
DOMAINS = [DOMAIN_SC, DOMAIN_SC_API, DOMAIN_BC, DOMAIN_YT, DOMAIN_YT_BE, DOMAIN_TT, DOMAIN_IG, DOMAIN_TW, DOMAIN_TWX]


# TODO get rid of these dumb exceptions:
Expand Down Expand Up @@ -727,7 +728,7 @@ def get_direct_urls_dict(message, mode, proxy, source_ip, allow_unknown_sites):
# TikTok: videos
# We know for sure these links can be downloaded, so we just skip running ydl_get_direct_urls
urls_dict[url_text] = "http"
elif DOMAIN_TW in url.host:
elif (DOMAIN_TW in url.host or DOMAIN_TWX in url.host) and (3 <= url_parts_num <= 3):
# Twitter: videos
# We know for sure these links can be downloaded, so we just skip running ydl_get_direct_urls
urls_dict[url_text] = "http"
Expand Down Expand Up @@ -954,7 +955,7 @@ def run_async(coro):
if DOMAIN_TT in host:
download_video = True
ydl_opts["videoformat"] = "mp4"
elif DOMAIN_TW in host:
elif DOMAIN_TW in host or DOMAIN_TWX in host:
download_video = True
ydl_opts["videoformat"] = "mp4"
elif DOMAIN_IG in host:
Expand Down

0 comments on commit 56c87cd

Please sign in to comment.