pop.py 599 B

12345678910111213141516171819
  1. #!/usr/bin/env python
  2. import requests
  3. import os
  4. import sys
  5. import json
  6. downloader = "aria2c"
  7. apiurl = "https://popcorn-time.ga"
  8. def main():
  9. title = ' '.join(sys.argv[1:]).replace(" ","%20")
  10. imdbid = json.loads(requests.get(f"https://v2.sg.media-imdb.com/suggests/{title[0]}/{title}.json").text.replace(f"imdb${title.replace('%20','_')}(","").replace(")",""))["d"][0]["id"]
  11. magnet = requests.get(f"{apiurl}/movie/{imdbid}").json()
  12. magnet = magnet["torrents"][magnet["original_language"]]["720p"]["url"]
  13. os.system(f"{downloader} {magnet}")
  14. if __name__ == "__main__":
  15. main()