Skip to content

Instantly share code, notes, and snippets.

@KebabLord
Created February 22, 2021 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KebabLord/b8abbcb8cf8d0cae19265a18ac6a7e40 to your computer and use it in GitHub Desktop.
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.
""" 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