Downcutup, biblioteca para Python de utilidades web y Youtube

Words
55
Reading
1 min
Listen
Play
9y

downcutup

Utilidades web y de la API de Youtube en Python3.

Download here


Install

Español:


English:

Requeriments:

First, you have to install FFMPEG for some functions. Check how to do it in your OS.

pdfkit, pytube & youtube-upload

sudo apt-get install wkhtmltopdf
sudo pip3 install pdfkit && sudo pip3 install pytube

sudo pip3 install --upgrade google-api-python-client progressbar2
wget https://github.com/tokland/youtube-upload/archive/master.zip
unzip master.zip
cd youtube-upload-master
sudo python3 setup.py install
PYTHONPATH=. python bin/youtube-upload

git clone https://github.com/mondeja/downcutup.git

You are free to expand the library!

Usage

from downcutup import *

# ------------   YOUTUBE UTILITIES ----------------
URL = 'https://www.youtube.com/watch?v=_efHyVzBSZA'

# Download video:    (As default in .mp4 with the best video quality)
download_video(URL,  # A url (str)
               save_in=None, # As default, the root dir
                             # (you can edit it in config.py file)
               filename_out=None, # As default, video name in youtube
               verbose=True) # As default in all functions, 
                             # prints advices in the process
   # Return:
      # (str) Name of the file --> 'Instalaciones downcutup.mp4'

# -----------------------------
# Cut video:
# First download a video and save the return.

video_name = download_video(URL)
cut(config.PATH + video_name,  # Filename in
    t1='00:01:10',     # (str) 'Hour:min:sec' 
    t2='00:01:20',     # (str) 'Hour:min:sec' 
    config.PATH + 'cutted_' + video_name) # Filename_out

# -----------------------------

# Download audio:   (As default in .wav with the best sound quality possible)
download_audio(URL, 
               filename_out=None, # Filename_out
               t1=None,    # (str) 'Hour:min:sec' 
               t2=None)    # (str) 'Hour:min:sec'
   # Return:
      # (str) Name of the file ---> 'Instalaciones downcutup.mp4'

# -----------------------------
# Downcutup:
# (Download., cut, and upload the cutted part of a video)

downcutup(URL,'Install WkHtmltoPdf',        # Title
              'How to install WkHtmltoPdf', # Description
              '00:01:00',    # start time
              '00:01:20',     # end time
              verbose=True,
              category=None,  # Configure options in the upload
              default_language=None,
              default_audio_language=None,
              playlist=None, # Insert in a playlist
              privacy=None, # 'public' as default. 
                            # (Insert privacy='private' if you don't want publish it
                            # or 'ocult' if  you want upload but that don't
                            # appears in your page channel
              thumbnail=None,  # Insert a thumbnail image 
              tags=None)

       #  Return:
           (str) New video url. 

# -----------------------------------------
# Youtube upload (upload a video to Youtube):
youtube_upload(URL,'Install WkHtmltoPdf',        # Title
              'How to install WkHtmltoPdf',      # Description
              '00:01:00',    # start time
              '00:01:20',     # end time
              **kwargs)  # The kwargs are the same than before function


# ------------   WEB UTILITIES ----------------
from web import *

# Download web in pdf:
download_web('http://siglo25.com/', 
              filename_out=None) # As default is the  web's title

# Download image:
download_image('http://siglo25.com/img/posts/cables_submarinos.png',
                filename_out=None) # As default is the image name