Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support p3.no (part of Norwegian Broadcasting Corporation) #8709

Closed
forthrin opened this issue Mar 1, 2016 · 5 comments
Closed

Support p3.no (part of Norwegian Broadcasting Corporation) #8709

forthrin opened this issue Mar 1, 2016 · 5 comments

Comments

@forthrin
Copy link

@forthrin forthrin commented Mar 1, 2016

NRK is supported by youtube-dl, but the underlying P3 channel (at separate domain p3.no) is not. Example:

~$ youtube-dl --verbose http://skam.p3.no
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'--verbose', u'http://skam.p3.no']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2016.02.10
[debug] Python version 2.7.11 - Darwin-15.3.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 2.8.3, ffprobe 2.8.3, rtmpdump 2.4
[debug] Proxy map: {}
[generic] skam.p3: Requesting header
WARNING: Falling back on generic information extractor.
[generic] skam.p3: Downloading webpage
[generic] skam.p3: Extracting information
ERROR: Unsupported URL: http://skam.p3.no
@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Mar 12, 2016

This URL looks like the main page of a website. You need to give an URL to a specific video yo youtube-dl.

@yan12125 yan12125 closed this Mar 12, 2016
@forthrin
Copy link
Author

@forthrin forthrin commented Mar 12, 2016

There are lots of videos if you scroll down the page, so youtube-dl should be able to download all of the videos in the page (similar to a playlist on YouTube). But since you ask, here is also a specific video page:

http://skam.p3.no/2016/03/04/strong-and-independent/

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Mar 12, 2016

Thanks for the URL. Sorry if my previous comment sounds offensive.

@TRox1972
Copy link
Contributor

@TRox1972 TRox1972 commented Jun 25, 2016

To developers: NRK embed

@forthrin
Copy link
Author

@forthrin forthrin commented Mar 30, 2019

This code extracts all videos from the front page. Should work inside each video page too. Feel free to create an extractor with it. I may give it a shot too, but I've never written one before, so...

#!/usr/bin/env python

import re
import json
import urllib2

def fetch(url):
    req = urllib2.Request(url, headers={"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0"})
    return urllib2.urlopen(req).read()

url = "https://blank.p3.no/"
html = fetch(url)
matches = re.findall("querySelector\('.*?'\), '(.*?)', ludoOptions", html)

playlist = []
for match in reversed(matches):
    url = "https://psapi.nrk.no/playback/manifest/clip/" + match
    data = fetch(url)
    meta = json.loads(data)
    playlist.append(meta["playable"]["assets"][0]["url"])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.