Skip to content

Commit

Permalink
Updated to work with the latest version of tum_live
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin-Metz committed Jan 31, 2023
1 parent 06790f9 commit 7ee0b43
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
auto-editor==22.48.1
requests==2.28.1
selenium==4.7.2
selenium-requests==2.0.2
auto-editor==23.4.1
requests==2.28.2
selenium==4.8.0
selenium-requests==2.0.3
BeautifulSoup4==4.11.1
PyYAML==6.0
14 changes: 4 additions & 10 deletions src/tum_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_video_links_of_subject(driver: webdriver, subjects_identifier, camera_ty
for video_url in video_urls:
driver.get(video_url + "/" + camera_type)
sleep(2)
filename = driver.find_element(By.XPATH, "/html/body/div[4]/div/div[2]/div[1]/div[1]/h1").text.strip()
filename = driver.find_element(By.XPATH, "/html/body/div[5]/div/div[3]/div/div[1]/h1").text.strip()
playlist_url = get_playlist_url(driver.page_source)
video_playlists.append((filename, playlist_url))

Expand All @@ -58,16 +58,10 @@ def get_video_links_of_subject(driver: webdriver, subjects_identifier, camera_ty


def get_playlist_url(source: str) -> str:
prefix = 'https://stream.lrz.de/vod/_definst_/mp4:tum/RBG/'
postfix = '/playlist.m3u8'
playlist_extracted_url = re.search(prefix + '(.+?)' + postfix, source)
if not playlist_extracted_url:
prefix = "https://live.stream.lrz.de/livetum/"
playlist_extracted_url = re.search(prefix + '(.+?)' + postfix, source)
if not playlist_extracted_url:
playlist_extracted_match = re.search("(https://\S+?/playlist\.m3u8.*?)[\'|\"]", source)
if not playlist_extracted_match:
raise Exception("Could not extract playlist URL from TUM-live! Page source:\n" + source)
playlist_extracted_url = playlist_extracted_url.group(1)
playlist_url = prefix + playlist_extracted_url + postfix
playlist_url = playlist_extracted_match.group(1)
return playlist_url


Expand Down

0 comments on commit 7ee0b43

Please sign in to comment.