Git Product home page Git Product logo

extract-youtube-mpd's Introduction

Extract YouTube MPD Information

A Python script to extract youtubes MPD file and print the information to the console

Requirements

  • (Linux)
  • Python 2.7 or better
  • libxml2 (e.g., sudo apt-get install python-libxml2)
  • urllib2

Usage

Example Call (will download the MPD file to aspen.mpd)

python extract.py https://www.youtube.com/watch?v=GTGUa4J8XKw aspen.mpd

Output (of the above Example, URLs shortened/anonymized):

Downloading HTML of https://www.youtube.com/watch?v=GTGUa4J8XKw 
Extracted MPDURL from HTML:  
https://manifest.googlevideo.com/api/manifest/dash/sparams/..... 
AdaptationSet,RepresentationID,Bitrate,Codec,ExtraInformation 
audio/mp4,140,127570,mp4a.40.2
video/mp4,133,247800,avc1.4d4015,426/240/24
video/mp4,134,601944,avc1.4d401e,640/360/24
video/mp4,135,1103336,avc1.4d401e,854/480/24
video/mp4,160,109967,avc1.42c00c,256/144/12
video/mp4,136,2206969,avc1.4d401f,1280/720/24
video/mp4,137,4144774,avc1.640028,1920/1080/24

Output Information

MPDs usually contain multiple AdaptationSet XML tags. Those contain a MimeType of either:

  • audio/mp4
  • audio/webm
  • video/mp4
  • video/webm

Within one AdaptationSet there are multiple Representation tags, which then contain information for each representation:

  • Bitrate (in Kilobit per second)
  • Codec
  • Information for Video Only (in ExtraInformation column of generated output):
  • Video Width
  • Video Height
  • Video Frame Rate

Acknowledgements

This work was partly funded by the Austrian Science Fund (FWF) under the CHIST-ERA project CONCERT (A Context-Adaptive Content Ecosystem Under Uncertainty), project number I1402 (see http://www.concert-project for more details).

extract-youtube-mpd's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

extract-youtube-mpd's Issues

About work environment

I want to run this program on windows,but I met some problems.The libxml2 library exists in Anconda. Why does the runtime prompt not exist?

Line mpdurl = html[html.find("dashmpd"):] returns empty

I am trying to execute the script using this command line
python3 extract.py https://www.youtube.com/watch?v=2d1VrCvdzbY test.mpd

But I don't seem to get a result or output.

Output:

File "extract.py", line 69, in
mpdurl = html[html.find("dashmpd"):]
TypeError: a bytes-like object is required, not 'str'

I have tried to fix this output with some .encode() next to the strings, and this solved at first the problem but it is still not returning an output.

It seems it is not able to find a result at line 69. Maybe the parameter is not called anymore "dashmpd"?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.