Created
February 22, 2021 10:47
-
-
Save KebabLord/b8abbcb8cf8d0cae19265a18ac6a7e40 to your computer and use it in GitHub Desktop.
Download reddit videos with sound without ffmpeg. Simply abuse reddit video downloader sites to get media url of video with sound.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Use reddit video downloader sites to get | |
URL of video with sound which they generated | |
""" | |
from re import findall | |
from requests import get | |
def reddit_vid(url): | |
""" Returns URL of video with sound. """ | |
response = get("https://lew.la/reddit/") | |
csrf_token = findall( | |
'token = "(.*?)"', | |
response.text | |
)[0] | |
headers = { | |
'Content-Type': 'application/json; charset=utf-8' , | |
'Referer': 'https://lew.la/reddit/' , | |
'X-CSRFToken': csrf_token, | |
'Cookie': f"session={response.cookies.get_dict()['session']}" | |
} | |
return "https://lew.la/reddit/"+get( | |
'https://lew.la/api/reddit/download/',headers=headers, | |
data='{"url":"'+url+'"}' | |
).text.split('"')[-2] | |
if __name__ == '__main__': | |
POST_URL = "https://www.reddit.com/r/arabfunny/comments/e5fqjb/pickle_rick_arab_dub/" | |
vid_url = reddit_vid(POST_URL) | |
print(f"download url: {vid_url}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment