Created
May 5, 2015 16:29
-
-
Save LEW21/02cac09a54dcf8ed939f to your computer and use it in GitHub Desktop.
TVP ISM/MP4 URL finder
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
import requests | |
import re | |
import sys | |
url = sys.argv[1] | |
prefix, url_id = url.rsplit("/", 1) | |
id = int(url_id) | |
player_url = "http://www.tvp.pl/sess/tvplayer.php?object_id=" + url_id | |
p = requests.get(player_url).text | |
try: | |
ism_url = re.search("src\\:'(.*/manifest)'", p).group(1) | |
except AttributeError: | |
ism_url = "" | |
try: | |
mp4_url = re.search("src\\:'(.*\\.mp4)'", p).group(1) | |
except AttributeError: | |
mp4_url = "" | |
print("ISM URL: " + ism_url) | |
print("MP4 URL: " + mp4_url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment