GithubHelp home page GithubHelp logo

pytoutv's Introduction

(See README.en.md for an English version.)

NOTE: En date du 25 septembre 2019, pytoutv ne fonctionne pas avec l'API de TOU.TV et n'est donc pas fonctionnel (voir problème #134.

pytoutv est une librairie écrite en Python 3 qui implémente un client pour TOU.TV.

Ce dépôt contient aussi une interface en ligne de commande.

pytoutv, grâce à l'API publique de TOU.TV (voir toutv/config.py pour les URL publiques), est en mesure de récupérer les listes d'émissions et d'épisodes, obtenir des informations sur des émissions ou des épisodes ou télécharger n'importe quel fichier vidéo distribué publiquement par le service TOU.TV. Les informations téléchargées, incluant les fichiers vidéo, sont destinées à un usage personnel et ne devraient pas être redistribuées, à moins d'une autorisation préalable fournie par les propriétaires de TOU.TV.

Le projet pytoutv n'est pas affilié, connecté ou associé à la Société Radio-Canada ou à CBFT-DT. La Société Radio-Canada ou CBFT-DT ne parrainent pas, n'approuvent pas ou n'endossent pas le projet pytoutv.

Note : bien qu'on parle de pytoutv 2, il n'existe pas de version 1 de pytoutv. Ce projet était auparavant connu sous le nom Tou.tv-console-application et ciblait Python 2. Son réusinage et son changement de nom vers pytoutv a mené à sa version 2. L'interface en ligne de commande demeure assez compatible avec la version précédente.

Dépendances

pytoutv requiert :

Dépendances facultatives :

pytoutv est réputé fonctionner sur Ubuntu, Debian, Fedora, Arch Linux et Mac OS X.

Installation

Il existe plusieurs méthodes pour installer pytoutv, la plus facile étant en passant par l'outil pip.

Veuillez noter que Python 3.3+ est requis peu importe la méthode utilisée.

Installation des dépendances

Les méthodes d'installation avec pip et setup.py vont automatiquement installer les dépendances Python pour vous. Ceci dit, il peut être préférable de les installer avec le gestionnaire de paquetages de votre distribution :

Sur Debian et Ubuntu, voici comment faire :

$ sudo aptitude install python3-crypto python3-requests python3-setuptools

Sur Fedora:

$ sudo yum install python3-crypto python3-requests python3-setuptools

Sur Arch Linux :

$ sudo pacman -Sy python-crypto python-requests python-setuptools

Avec pip

Assurez-vous d'avoir pip et setuptools. Votre distribution favorite devrait fournir une façon d'obtenir ces paquetages.

Installez ensuite pytoutv à l'aide de pip :

$ sudo pip install pytoutv

Ubuntu et Debian

Sur Debian et Ubuntu, pip utilise par défaut les dépendances en Python 2. Pour régler ce problème, vous pouvez télécharger la version Python 3 de pip :

$ sudo aptitude install python3-pip

Par la suite, il ne suffit que de lancer l'installation avec ce paquet:

$ sudo pip3 install pytoutv

Fedora

Sur Fedora, pip utilise par défaut les dépendances en Python 2. Pour régler ce problème, vous pouvez télécharger la version Python 3 de pip :

$ sudo yum install python3-pip

Par la suite, il ne suffit que de lancer l'installation avec ce paquet:

$ sudo python3-pip install pytoutv

Mac OS X

Apple fournissent leur propre version de Python 2.7, pré-installé avec le système d'exploitation. C'est bien, mais nous avons besoin de 3.3 minimum.

Rendez-vous sur https://www.python.org/download/ pour télécharger la dernière version de Python compatible avec votre système.

Installez-le et ouvrez votre terminal. Si l'exécution de "python3.X" (X étant la sous-version installée, comme 3.3 ou 3.4) vous ouvre le mode de commande de Python 3.3+, tout est correct.

Quittez Python et exécutez:

"sudo pip3 install pytoutv"

Si tout se passe bien, vous devriez ensuite pouvoir l'exécuter!

À NOTER: Il semble que le script d'installation ne place pas de chemin global. Ajoutez: "/Library/Frameworks/Python.framework/Versions/3.4/bin" à "/etc/paths".

Avec setup.py

Tant que vous avez setuptools, vous pouvez installer pytoutv directement en utilisant son script setup.py :

  1. Clonez le dépôt :

    $ git clone https://github.com/bvanheu/pytoutv && cd pytoutv

  2. Lancez le script d'installation :

    $ sudo ./setup.py install

Librairie

La documentation de la librairie n'est pas encore disponible.

Ligne de commande

L'outil en ligne de commande se nomme simplement toutv. Les commandes les plus couramment utilisées sont:

  • list: afficher les émissions ou les épisodes d'une émission donnée
  • info: afficher les informations d'une émission ou d'un épisode
  • fetch: télécharger un épisode ou tous les épisodes d'une émission donnée
  • search: chercher un mot-clé parmi les émissions et épisodes
  • login: fournir les informations de connexion pour Tou.TV Extra

Utilisez toutv -h et toutv <commande> -h pour obtenir plus d'informations à propos des commandes et de leur utilisation.

Proxy

Veuillez noter que toutv honore les variables d'environnement HTTP_PROXY et HTTPS_PROXY, qui devraient contenir les URL complètes des proxies à utiliser, incluant le schéma (http://, https://).

Exemples

Voici quelques exemples d'utilisation de l'interface en ligne de commande.

Se connecter à la section extra de tou.tv

Ceci est requis pour pouvoir télécharger la version 720p des vidéos, et pour télécharger les émissions qui sont exclusives aux membres de la section Extra. Pour les autres cas, le login est optionnel.

$ toutv login <USERNAME>
Password: <PASSWORD>
Login successful
Token: c3458d85-6094-4030-9454-114380b2dec0

Liste de toutes les émissions

Note: toutes les émissions, incluant celles qui sont exclusives aux membres de la section Extra.

$ toutv list
2416249839: 2030, Le Big Bang démographique
2424965959: 26 lettres
1735242576: 30 vies
2415880603: Ainsi soient-ils
2284422575: Air de famille (Un)
2424965905: Alain Bashung faisons envie
2424966134: Alfred Hitchcock : Agent secret
2424966154: Alfred Hitchcock : Aventure malgache
...

Liste des épisodes d'une émission

$ toutv list 'physique ou chimie'
Physique ou chimie:

  * 2160477711: S01E01 Des choses à faire avant de mourir
  * 2160477623: S01E02 Agir ou laisser faire
  * 2160483636: S01E03 Uniquement sexuel
  * 2160483351: S01E04 Dommages collatéraux
  * 2160490365: S01E05 Une victoire très curieuse
  * 2160490718: S01E06 Il en faut du courage
  * 2160497332: S01E07 Aller de l’avant
  * 2160497534: S01E08 Le prix de la liberté
  * 2161200777: S01E09 Égoïsme raisonnable
  * 2161201111: S01E10 Réactions en chaîne
  ...

Informations d'une émission

$ toutv info 'physique ou chimie'
Physique ou chimie  [Unknown country]

Blanche, Irène, Jonathan et Rock, professeurs au Collège Zurbarán à Madrid, sont
censés servir de guides à leurs étudiants, alors qu'eux-mêmes ont une vie
compliquée. Ils découvriront assez rapidement qu'enseigner est la meilleure
façon d'apprendre la vie. Entre amours, amitiés, trahisons et déceptions, la
série espagnole Physique ou chimie met de l’avant les hauts et les bas que
vivent les élèves et les professeurs.


Infos:

  * Tags: jeunesse, rogers

Informations d'un épisode

$ toutv info 'Série noire' S01E08
Série noire
Épisode 8  [S01E08]

Ébranlés par les récentes découvertes, Denis et Patrick tentent d’en savoir
davantage sur l’identité de la mystérieuse femme corpulente. Charlène et Judith
les aideront-elles à éclaircir cette nouvelle piste? Victimes d’un kidnapping,
Denis et Patrick découvrent, au péril de leur vie, les motivations étonnantes de
l’organisation criminelle de Bruno.


Infos:

  * Air date: 2014-03-03
  * Available bitrates:
    * 461 kbps
    * 561 kbps
    * 925 kbps
    * 1324 kbps

Téléchargement d'un épisode

$ toutv fetch Enquete S2014E11
Enquête.S2014E11.La.guerre.d...    28.8 MiB    24/260 [##-----------------]   9%

Téléchargement d'un épisode avec la meilleure qualité vidéo disponible

$ toutv fetch -q MAX 'série noire' s01e05
Série.noire.S01E05.Épisode.5...    63.7 MiB    38/260 [###----------------]  14%

Téléchargement de tous les épisodes d'une émission donnée avec une qualité moyenne

$ toutv fetch 'en audition avec simon'
En.audition.avec.Simon.S01E01...    16.5 MiB   15/15 [####################] 100%
En.audition.avec.Simon.S03E47...    24.9 MiB   23/23 [####################] 100%
En.audition.avec.Simon.S01E17...     9.9 MiB    9/27 [#######-------------]  33%
...

Spécifier une émission ou un épisode avec un URL

Vous pouvez utiliser un URL tou.tv au lieu d'un nom pour une émission ou un épisode, pour les commandes fetch, info, et list.

$ toutv fetch http://ici.tou.tv/le-show-cache-2
$ toutv fetch http://ici.tou.tv/le-show-cache-2/S2014E02
$ toutv info http://ici.tou.tv/le-show-cache-2
$ toutv info http://ici.tou.tv/le-show-cache-2/S2014E02
$ toutv list http://ici.tou.tv/le-show-cache-2

Recherche d'émissions et d'épisodes

$ toutv search politique
Effective query: politique

Episode: Loi 101 : Le malaise de René Lévesque (1re partie)  [1481687502]

  * Air date: 2010-04-27
  * Emission ID: 1480980995

  En 1976, le Parti québécois remporte pour la première fois les élections sur
  la promesse d’être un bon gouvernement. Sans avoir mis la question de la
  langue au cœur du débat électoral, René Lévesque avait promis de revoir la loi
  22. Il confie ce mandat à Camille Laurin.


Episode: Loi 101 : le combat de Camille Laurin (2e partie)  [1485812723]

  * Air date: 2010-05-04
  * Emission ID: 1480980995

  La loi 101 sera, pour Camille Laurin, le combat de sa vie. Il s’entoure
  d’abord des meilleurs esprits de son temps pour rédiger la Charte de la langue
  française. René Lévesque lui demande d’aller convaincre la population
  québécoise. Il affronte alors la colère de la communauté anglaise. À force de
  ruse et de détermination, Camille Laurin dépose finalement le projet de loi
  qui transformera le paysage linguistique du Québec.


Episode: Sommet des Amériques et Sommet des peuples  [1498400939]

  * Air date: 2010-05-18
  * Emission ID: 1480980995

  En 2001, un sommet parallèle s’organise dans la basse-ville de Québec pour
  répliquer aux négociations officielles d’un traité de libre-échange des trois
  Amériques. Le Sommet des peuples accueille 2000 représentants syndicaux, des
  organismes sociaux et féministes, d’ici et d’ailleurs en Amérique. Cinquante
  mille personnes sortent dans la rue pour s’opposer pacifiquement. D’autres
  manifestants préfèrent affronter la police.


Episode: L'humour politique II : Les années 70  [1573008143]

  * Air date: 2010-08-17
  * Emission ID: 1480980995

  Les années 70 sont fertiles en bouleversements. C’est l’ère des imitateurs, de
  la montée du féminisme et le début de l’humour au féminin. Invités : Jean-Guy
  Moreau, Claude Landré et Clémence DesRochers.

...

Bogues

pytoutv est réputé fonctionner en date du dernier commit de ce dépôt. Si vous rencontrez un bogue quelconque, nous vous saurons gré de créer un problème et de fournir le plus de détails possibles à propos de votre situation, en plus de spécifier ce qui ne fonctionne pas tel que prévu.

Contribuer

Afin de contribuer à n'importe quelle composante de ce projet, envoyez-nous un pull request GitHub. Assurez-vous que votre code Python suive PEP-8, sauf pour de très longues lignes qui ne peuvent pas être cassées (longues chaines, par exemple).

Flux de travail avec Python

La meilleure façon de développer pytoutv localement sans avoir à l'installer globalement est de créer un virtualenv. Si vous n'avez pas virtualenv, procurez-vous le (la plupart des distributions le fournissent en tant que paquetage).

  1. Dans la racine du dépôt, créez le virtualenv :

    $ virtualenv virt

  2. Activez le virtualenv :

    $ . ./virt/bin/activate

  3. Utilisez la commande develop du script setup.py :

    $ ./setup.py develop

    La première fois que ceci s'exécute, si vous n'avez pas toutes les dépendances du projet, elles seront téléchargées et installées (localement, dans virt).

Suite à l'étape 3, vous pouvez exécuter toutv (qui pointe maintenant vers la version locale de la commande). Vous pouvez aussi lancer ipython et importer des modules de toutv; les versions locales seront importées.

Versionnage sémantique

pytoutv suit un versionnage sémantique. Si vous soumettez un simple correctif, nous incrémenterons la version de patch. Si vous soumettez une nouvelle fonctionnalité, nous incrémenterons la version mineure. Aucune version 3 de pytoutv n'est prévu pour l'instant.

Contributeurs

Nous tenons à remercier spécialement :

pytoutv's People

Contributors

anarcat avatar anthonydahanne avatar bmaupin avatar bvanheu avatar eepp avatar gboudreau avatar gdoucet avatar isra17 avatar remi avatar roubarbe avatar scarpentier avatar simark avatar spiette avatar

Stargazers

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

Watchers

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

pytoutv's Issues

Unable to fetch newer content

Using the fetch command on newer content (for example content ID 2424966619):

toutv fetch -q MAX '############################'

I receive: Error: cannot fetch "############################": unexpected HTTP status code

Any insight as to what I might be doing wrong?

PS : I voluntarily replaced the show's title by ####.

Problem with Unicode on Windows

There is a problem with Unicode support on Windows. It might be the fact that the terminal is not in UTF8?

To reproduce:

C:\Users\Gabriel\Desktop\Tou.tv-console-application-master>toutv-cli.py fetch --bitrate 790000 "Découverte" S2012E04
unable to find 'DÚcouverte'
did you mean one of the following?
        D├®COUVERTE
        BAR OUVERT
C:\Users\Gabriel\Desktop\Tou.tv-console-application-master> 

SSL: CERTIFICATE_VERIFY_FAILED on newer episodes

Episodes of the latest season, since January 2015 (maybe others, but this seems consistent), are failing to download with an SSL certificate verification failure.

Unknown error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

I'm guessing the network has yet again changed its protocol, but I am uncertain as to how to debug this.

Unknown error: 'NoneType' object has no attribute 'uri'

toutv fetch -q MAX "Unite 9" S05E11
Cannot find "Unite 9"
Did you mean "UNITÉ 9"?

toutv fetch -q MAX "Unité 9" S05E11
Unknown error: 'NoneType' object has no attribute 'uri'

toutv fetch -q MAX "Unité 9" S05E10
Destination file exists (use -f to force)

toutv fetch -q MAX "Unité 9" S05E11
Unknown error: 'NoneType' object has no attribute 'uri'

doesn't install on Windows

C:\Users\sirber\Documents\GitHub\pytoutv>python setup.py install
running install
running bdist_egg
running egg_info
writing requirements to pytoutv.egg-info\requires.txt
writing entry points to pytoutv.egg-info\entry_points.txt
writing dependency_links to pytoutv.egg-info\dependency_links.txt
writing top-level names to pytoutv.egg-info\top_level.txt
writing pytoutv.egg-info\PKG-INFO
reading manifest file 'pytoutv.egg-info\SOURCES.txt'
writing manifest file 'pytoutv.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
creating build\bdist.win32\egg
creating build\bdist.win32\egg\toutv
copying build\lib\toutv\bos.py -> build\bdist.win32\egg\toutv
copying build\lib\toutv\cache.py -> build\bdist.win32\egg\toutv
copying build\lib\toutv\client.py -> build\bdist.win32\egg\toutv
copying build\lib\toutv\config.py -> build\bdist.win32\egg\toutv
copying build\lib\toutv\dl.py -> build\bdist.win32\egg\toutv
copying build\lib\toutv\exceptions.py -> build\bdist.win32\egg\toutv
copying build\lib\toutv\m3u8.py -> build\bdist.win32\egg\toutv
copying build\lib\toutv\mapper.py -> build\bdist.win32\egg\toutv
copying build\lib\toutv\transport.py -> build\bdist.win32\egg\toutv
copying build\lib\toutv__init__.py -> build\bdist.win32\egg\toutv
creating build\bdist.win32\egg\toutvcli
copying build\lib\toutvcli\app.py -> build\bdist.win32\egg\toutvcli
copying build\lib\toutvcli\app_test.py -> build\bdist.win32\egg\toutvcli
copying build\lib\toutvcli\progressbar.py -> build\bdist.win32\egg\toutvcli
copying build\lib\toutvcli__init__.py -> build\bdist.win32\egg\toutvcli
creating build\bdist.win32\egg\toutvqt
copying build\lib\toutvqt\about_dialog.py -> build\bdist.win32\egg\toutvqt
copying build\lib\toutvqt\app.py -> build\bdist.win32\egg\toutvqt
copying build\lib\toutvqt\choose_bitrate_dialog.py -> build\bdist.win32\egg\tout
vqt
copying build\lib\toutvqt\config.py -> build\bdist.win32\egg\toutvqt
creating build\bdist.win32\egg\toutvqt\dat
creating build\bdist.win32\egg\toutvqt\dat\icons
copying build\lib\toutvqt\dat\icons\about_action.png -> build\bdist.win32\egg\to
utvqt\dat\icons
copying build\lib\toutvqt\dat\icons\cancel_action.png -> build\bdist.win32\egg\t
outvqt\dat\icons
copying build\lib\toutvqt\dat\icons\open_action.png -> build\bdist.win32\egg\tou
tvqt\dat\icons
copying build\lib\toutvqt\dat\icons\open_dir_action.png -> build\bdist.win32\egg
\toutvqt\dat\icons
copying build\lib\toutvqt\dat\icons\preferences_action.png -> build\bdist.win32
egg\toutvqt\dat\icons
copying build\lib\toutvqt\dat\icons\quit_action.png -> build\bdist.win32\egg\tou
tvqt\dat\icons
copying build\lib\toutvqt\dat\icons\refresh_emissions_action.png -> build\bdist.
win32\egg\toutvqt\dat\icons
copying build\lib\toutvqt\dat\icons\remove_item_action.png -> build\bdist.win32
egg\toutvqt\dat\icons
copying build\lib\toutvqt\dat\icons\toutv.png -> build\bdist.win32\egg\toutvqt\d
at\icons
creating build\bdist.win32\egg\toutvqt\dat\ui
copying build\lib\toutvqt\dat\ui\about_dialog.ui -> build\bdist.win32\egg\toutvq
t\dat\ui
copying build\lib\toutvqt\dat\ui\choose_bitrate_dialog.ui -> build\bdist.win32\e
gg\toutvqt\dat\ui
copying build\lib\toutvqt\dat\ui\emission_infos_widget.ui -> build\bdist.win32\e
gg\toutvqt\dat\ui
copying build\lib\toutvqt\dat\ui\episode_infos_widget.ui -> build\bdist.win32\eg
g\toutvqt\dat\ui
copying build\lib\toutvqt\dat\ui\main_window.ui -> build\bdist.win32\egg\toutvqt
\dat\ui
copying build\lib\toutvqt\dat\ui\preferences_dialog.ui -> build\bdist.win32\egg
toutvqt\dat\ui
copying build\lib\toutvqt\dat\ui\season_infos_widget.ui -> build\bdist.win32\egg
\toutvqt\dat\ui
copying build\lib\toutvqt\downloads_itemdelegate.py -> build\bdist.win32\egg\tou
tvqt
copying build\lib\toutvqt\downloads_tablemodel.py -> build\bdist.win32\egg\toutv
qt
copying build\lib\toutvqt\downloads_tableview.py -> build\bdist.win32\egg\toutvq
t
copying build\lib\toutvqt\download_manager.py -> build\bdist.win32\egg\toutvqt
copying build\lib\toutvqt\emissions_treemodel.py -> build\bdist.win32\egg\toutvq
t
copying build\lib\toutvqt\emissions_treeview.py -> build\bdist.win32\egg\toutvqt

copying build\lib\toutvqt\infos_frame.py -> build\bdist.win32\egg\toutvqt
copying build\lib\toutvqt\main_window.py -> build\bdist.win32\egg\toutvqt
copying build\lib\toutvqt\preferences_dialog.py -> build\bdist.win32\egg\toutvqt

copying build\lib\toutvqt\settings.py -> build\bdist.win32\egg\toutvqt
copying build\lib\toutvqt\utils.py -> build\bdist.win32\egg\toutvqt
copying build\lib\toutvqt__init__.py -> build\bdist.win32\egg\toutvqt
byte-compiling build\bdist.win32\egg\toutv\bos.py to bos.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutv\cache.py to cache.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutv\client.py to client.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutv\config.py to config.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutv\dl.py to dl.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutv\exceptions.py to exceptions.cpython-3
5.pyc
byte-compiling build\bdist.win32\egg\toutv\m3u8.py to m3u8.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutv\mapper.py to mapper.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutv\transport.py to transport.cpython-35.
pyc
byte-compiling build\bdist.win32\egg\toutv__init__.py to init.cpython-35.py
c
byte-compiling build\bdist.win32\egg\toutvcli\app.py to app.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutvcli\app_test.py to app_test.cpython-35
.pyc
byte-compiling build\bdist.win32\egg\toutvcli\progressbar.py to progressbar.cpyt
hon-35.pyc
byte-compiling build\bdist.win32\egg\toutvcli__init__.py to init.cpython-35
.pyc
byte-compiling build\bdist.win32\egg\toutvqt\about_dialog.py to about_dialog.cpy
thon-35.pyc
byte-compiling build\bdist.win32\egg\toutvqt\app.py to app.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutvqt\choose_bitrate_dialog.py to choose_
bitrate_dialog.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutvqt\config.py to config.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutvqt\downloads_itemdelegate.py to downlo
ads_itemdelegate.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutvqt\downloads_tablemodel.py to download
s_tablemodel.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutvqt\downloads_tableview.py to downloads
tableview.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutvqt\download_manager.py to download_man
ager.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutvqt\emissions_treemodel.py to emissions
treemodel.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutvqt\emissions_treeview.py to emissions

treeview.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutvqt\infos_frame.py to infos_frame.cpyth
on-35.pyc
byte-compiling build\bdist.win32\egg\toutvqt\main_window.py to main_window.cpyth
on-35.pyc
byte-compiling build\bdist.win32\egg\toutvqt\preferences_dialog.py to preference
s_dialog.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutvqt\settings.py to settings.cpython-35.
pyc
byte-compiling build\bdist.win32\egg\toutvqt\utils.py to utils.cpython-35.pyc
byte-compiling build\bdist.win32\egg\toutvqt__init
_.py to init.cpython-35.
pyc
creating build\bdist.win32\egg\EGG-INFO
copying pytoutv.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
copying pytoutv.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
copying pytoutv.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFO
copying pytoutv.egg-info\entry_points.txt -> build\bdist.win32\egg\EGG-INFO
copying pytoutv.egg-info\requires.txt -> build\bdist.win32\egg\EGG-INFO
copying pytoutv.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist\pytoutv-2.3.0-py3.5.egg' and adding 'build\bdist.win32\egg' to it

removing 'build\bdist.win32\egg' (and everything under it)
Processing pytoutv-2.3.0-py3.5.egg
Removing c:\users\sirber\appdata\local\programs\python\python35-32\lib\site-pack
ages\pytoutv-2.3.0-py3.5.egg
Copying pytoutv-2.3.0-py3.5.egg to c:\users\sirber\appdata\local\programs\python
\python35-32\lib\site-packages
pytoutv 2.3.0 is already the active version in easy-install.pth
Installing toutv-script.py script to C:\Users\sirber\AppData\Local\Programs\Pyth
on\Python35-32\Scripts
Installing toutv.exe script to C:\Users\sirber\AppData\Local\Programs\Python\Pyt
hon35-32\Scripts
Installing toutv.exe.manifest script to C:\Users\sirber\AppData\Local\Programs\P
ython\Python35-32\Scripts
Installing qtoutv-script.pyw script to C:\Users\sirber\AppData\Local\Programs\Py
thon\Python35-32\Scripts
Installing qtoutv.exe script to C:\Users\sirber\AppData\Local\Programs\Python\Py
thon35-32\Scripts
Installing qtoutv.exe.manifest script to C:\Users\sirber\AppData\Local\Programs
Python\Python35-32\Scripts

Installed c:\users\sirber\appdata\local\programs\python\python35-32\lib\site-pac
kages\pytoutv-2.3.0-py3.5.egg
Processing dependencies for pytoutv==2.3.0
Searching for pycrypto>=2.0.0
Reading https://pypi.python.org/simple/pycrypto/
Best match: pycrypto 2.6.1
Downloading https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.ta
r.gz#md5=55a61a054aa66812daf5161a0d5d7eda
Processing pycrypto-2.6.1.tar.gz
Writing C:\Users\sirber\AppData\Local\Temp\easy_install-qcn51fml\pycrypto-2.6.1
setup.cfg
Running pycrypto-2.6.1\setup.py -q bdist_egg --dist-dir C:\Users\sirber\AppData
Local\Temp\easy_install-qcn51fml\pycrypto-2.6.1\egg-dist-tmp-b5oi4mfl
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.

error: Setup script exited with error: [WinError 2] The system cannot find the f
ile specified

Subtitles

Hello,

many of the episodes on ici.tou.tv have subtitles available.

You can download them like this:

  • Firefox: Analyse element
  • Go to network
  • activate the subtitles
  • Search for 'vtt'

It's a vtt file, but the syntax is like in a srt file, so any standard video player will be able to play them.

Maybe you can integrate that into toutv? It's really helpful for people like me, who want to improve their French.

Regards,
MPW

Playing file downloaded from Windows doesn't work

Looks like the problem is with how newlines are handled with python and Windows (\r\n vs \n).

Although i don't know why it would cause a problem, it looks like mplayer and VLC fail to play the downloaded file.

Give feedback or don't block UI while multiple downloads are added

When adding multiple downloads (all the episodes of a show or a season), the UI blocks completely while we download the m3u8 playlist of all the episodes. This takes quite some time, during which the whole UI is frozen.

At first, some feedback should be given to indicate the progression, with a possibility of cancellation.

Also, this operation would benefit a lot from being paralellized. The latency of doing one small HTTP GET is quite high, but the size of the response is small. We could send a bunch of requests in parallel and wait for them to come back.

Read timed out

Hi guys,

I having trouble downloading an episode:

$ toutv fetch -q MAX -d epi7 "Dans l'oeil du dragon" "S03E07"
Dans.l'oeil.du.dragon.S03E07.Episode.7.2124kbps.ts                                 118.7 MiB    44/260 [#########-------------------------------------------]  16%Unknown error: HTTPConnectionPool(host='toutvuniver1-vh.akamaihd.net', port=80): Read timed out.

Might be related to #36 . A resume feature would be great; do you know if it is supported by Tou.Tv ?

L'ETS est partout!

Merci Vanheu!

"emission" is usually about chemicals or electromagnetic radiations :)

I know that in french, "emission" is the right word, but in english it's just weird. :) To give you an idea, here's wikipedia's "Emission" disambuguation page.

The proper word would be a "program" or "show", according again to wikipedia: Television program.

I think the word should be changed in the README.md file and in the usage. Of course, it's fine if "emission" remains in the french translation (assuming there is one in the user interface!) - and it should obviously be "émission" as well. :)

I'd be happy to submit a PR for this.

Et je dis ceci comme un francophone qui s'enfarge sur son français des fois. Mais en anglais c'est juste bizarre...

"certificate verify failed" when downloading

there seems to be certain videos that fail to download because of problems with HTTPS:

$ toutv fetch Infoman S15E16
Unknown error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

wget seems to be able to get the file correctly, however:

$ strace -s 8192 -e recvfrom toutv fetch Infoman S15E16
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=24340, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=24341, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
recvfrom(5, "\7\216\201\200\0\1\0\2\0\1\0\0\3api\fradio-canada\2ca\0\0\34\0\1\300\f\0\5\0\1\0\0\7\324\0\34\3san\7src-cbc\2ca\7edgekey\3net\0\3001\0\5\0\1\0\0>\334\0\25\5e5627\1g\nakamaiedge\300H\300_\0\6\0\1\0\0\2M\0001\3n0g\300a\nhostmaster\6akamai\3com\0T\253\\e\0\0\3\350\0\0\3\350\0\0\3\350\0\0\7\10", 2048, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.0.1")}, [16]) = 171
recvfrom(5, "|\342\201\200\0\1\0\3\0\0\0\0\3api\fradio-canada\2ca\0\0\1\0\1\300\f\0\5\0\1\0\0\7\324\0\34\3san\7src-cbc\2ca\7edgekey\3net\0\3001\0\5\0\1\0\0>\334\0\25\5e5627\1g\nakamaiedge\300H\300Y\0\1\0\1\0\0\0\24\0\4\27\t`\311", 1877, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.0.1")}, [16]) = 126
recvfrom(5, "HTTP/1.1 200 OK\r\nServer: Microsoft-IIS/7.5\r\nContent-Length: 382\r\nContent-Type: application/json\r\nAccess-Control-Allow-Headers: *\r\nAccess-Control-Allow-Origin: *\r\nX-Powered-By: ASP.NET\r\nETag: \"90aeefc1affecf1:0\"\r\nDate: Tue, 06 Jan 2015 04:01:05 GMT\r\nConnection: keep-alive\r\n\r\n{\"url\":\"https://toutvuniver1-vh.akamaihd.net/i/012/mp4/i/2014-12-31_22_00_00_infoman_0385_,400,500,800,1200,.mp4.csmil/master.m3u8?hdnea=st=1420516862~exp=1420516877~acl=/i/012/mp4/i/2014-12-31_22_00_00_infoman_0385_*~hmac=b7beecbc39e2c89fc033f8946e74d0771adb92acbbe36d75332ace8c4722d5ed\",\"message\":null,\"errorCode\":0,\"params\":[{\"name\":\"mediaType\",\"value\":\"video\"}],\"bitrates\":null}", 8192, 0, NULL, NULL) = 657
recvfrom(5, "\360-\201\200\0\1\0\1\0\1\0\0\17toutvuniver1-vh\10akamaihd\3net\0\0\34\0\1\300\f\0\5\0\1\0\0\0\362\0\22\4a214\3w10\6akamai\300%\300?\0\6\0\1\0\0\2N\0003\5n0w10\300C\nhostmaster\6akamai\3com\0T\253\\f\0\0\3\350\0\0\3\350\0\0\3\350\0\0\7\10", 2048, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.0.1")}, [16]) = 139
recvfrom(5, "wI\201\200\0\1\0\3\0\0\0\0\17toutvuniver1-vh\10akamaihd\3net\0\0\1\0\1\300\f\0\5\0\1\0\0\0\362\0\22\4a214\3w10\6akamai\300%\300:\0\1\0\1\0\0\0\24\0\4\330\234\307*\300:\0\1\0\1\0\0\0\24\0\4\330\234\307)", 1909, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.0.1")}, [16]) = 108
Unknown error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)
+++ exited with 100 +++
$ wget https://toutvuniver1-vh.akamaihd.net/i/012/mp4/i/2014-12-31_22_00_00_infoman_0385_,400,500,800,1200,.mp4.csmil/master.m3u8?hdnea=st=1420516862~exp=1420516877~acl=/i/012/mp4/i/2014-12-31_22_00_00_infoman_0385_*~hmac=b7beecbc39e2c89fc033f8946e74d0771adb92acbbe36d75332ace8c4722d5ed
--2015-01-05 23:01:15--  https://toutvuniver1-vh.akamaihd.net/i/012/mp4/i/2014-12-31_22_00_00_infoman_0385_,400,500,800,1200,.mp4.csmil/master.m3u8?hdnea=st=1420516862~exp=1420516877~acl=/i/012/mp4/i/2014-12-31_22_00_00_infoman_0385_*~hmac=b7beecbc39e2c89fc033f8946e74d0771adb92acbbe36d75332ace8c4722d5ed
Résolution de toutvuniver1-vh.akamaihd.net (toutvuniver1-vh.akamaihd.net)… 216.156.199.42, 216.156.199.41
Connexion à toutvuniver1-vh.akamaihd.net (toutvuniver1-vh.akamaihd.net)|216.156.199.42|:443… connecté.
requête HTTP transmise, en attente de la réponse… 200 OK
Taille : 1285 (1,3K) [application/vnd.apple.mpegurl]
Sauvegarde en : « master.m3u8?hdnea=st=1420516862~exp=1420516877~acl=%2Fi%2F012%2Fmp4%2Fi%2F2014-12-31_22_00_00_infoman_0385_*~hmac=b7beecbc39e2c89fc033f8946e74d0771adb92acbbe36d75332ace8c4722d5ed »

master.m3u8?hdnea=st=1420516862~exp=1420516877~acl=%2Fi%2F0 100%[============================================================================================================================================>]   1,25K  --.-KB/s   ds 0s

2015-01-05 23:01:15 (13,1 MB/s) — « master.m3u8?hdnea=st=1420516862~exp=1420516877~acl=%2Fi%2F012%2Fmp4%2Fi%2F2014-12-31_22_00_00_infoman_0385_*~hmac=b7beecbc39e2c89fc033f8946e74d0771adb92acbbe36d75332ace8c4722d5ed » sauvegardé [1285/1285]

Now, interestingly, other episodes seem to download fine:

$ toutv fetch -f Enquête S2014E11
Enquête.S2014E11.La.guerre.des.bois.925kbps.ts                                                                                    776.0 kiB     0/260 [----------------------------------------------------------------------------------]   0%

... this one is not served from an HTTPS url!

$ strace -e recvfrom -s 4096 toutv fetch -f Enquête S2014E11
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=24760, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=24761, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
recvfrom(5, "s\351\201\200\0\1\0\3\0\0\0\0\3api\fradio-canada\2ca\0\0\1\0\1\300\f\0\5\0\1\0\0\7M\0\34\3san\7src-cbc\2ca\7edgekey\3net\0\3001\0\5\0\1\0\0>U\0\25\5e5627\1g\nakamaiedge\300H\300Y\0\1\0\1\0\0\0\5\0\4\27\t`\311", 2048, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.0.1")}, [16]) = 126
recvfrom(5, "V\234\201\200\0\1\0\2\0\1\0\0\3api\fradio-canada\2ca\0\0\34\0\1\300\f\0\5\0\1\0\0\7M\0\34\3san\7src-cbc\2ca\7edgekey\3net\0\3001\0\5\0\1\0\0>U\0\25\5e5627\1g\nakamaiedge\300H\300_\0\6\0\1\0\0\1\306\0001\3n0g\300a\nhostmaster\6akamai\3com\0T\253\\e\0\0\3\350\0\0\3\350\0\0\3\350\0\0\7\10", 1922, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.0.1")}, [16]) = 171
recvfrom(5, "HTTP/1.1 200 OK\r\nServer: Microsoft-IIS/7.5\r\nContent-Length: 368\r\nContent-Type: application/json\r\nAccess-Control-Allow-Headers: *\r\nAccess-Control-Allow-Origin: *\r\nX-Powered-By: ASP.NET\r\nETag: \"90aeefc1affecf1:0\"\r\nDate: Tue, 06 Jan 2015 04:03:19 GMT\r\nConnection: keep-alive\r\n\r\n{\"url\":\"http://cp143903-f.akamaihd.net/i/012/mp4/e/2014-12-04_21_00_00_enq_0174_,400,500,800,1200,.mp4.csmil/master.m3u8?hdnea=st=1420516996~exp=1420517011~acl=/i/012/mp4/e/2014-12-04_21_00_00_enq_0174_*~hmac=595a0a471796cda7f848bdc72d6e6964faa157c1b43ad67066fce35949fb5038\",\"message\":null,\"errorCode\":0,\"params\":[{\"name\":\"mediaType\",\"value\":\"video\"}],\"bitrates\":null}", 8192, 0, NULL, NULL) = 643
recvfrom(5, "\3755\201\200\0\1\0\3\0\0\0\0\ncp143903-f\10akamaihd\3net\0\0\1\0\1\300\f\0\5\0\1\0\0\0|\0\20\2a5\3w23\6akamai\300 \3005\0\1\0\1\0\0\0\5\0\4\314\234\0170\3005\0\1\0\1\0\0\0\5\0\4\314\234\17\t", 2048, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.0.1")}, [16]) = 101
recvfrom(5, "9\372\201\200\0\1\0\1\0\1\0\0\ncp143903-f\10akamaihd\3net\0\0\34\0\1\300\f\0\5\0\1\0\0\0|\0\20\2a5\3w23\6akamai\300 \3008\0\6\0\1\0\0\2\7\0003\5n0w23\300<\nhostmaster\6akamai\3com\0T\253\\\247\0\0\3\350\0\0\3\350\0\0\3\350\0\0\7\10", 1947, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.0.1")}, [16]) = 132
recvfrom(5, "HTTP/1.0 200 OK\r\nServer: AkamaiGHost\r\nMime-Version: 1.0\r\nContent-Type: application/vnd.apple.mpegurl\r\nContent-Length: 1551\r\nPragma: no-cache\r\nCache-Control: no-store\r\nExpires: Tue, 06 Jan 2015 04:03:19 GMT\r\nDate: Tue, 06 Jan 2015 04:03:19 GMT\r\nConnection: keep-alive\r\nSet-Cookie: hdntl=exp=1420603399~acl=%2fi%2f012%2fmp4%2fe%2f2014-12-04_21_00_00_enq_0174_*~data=hdntl~hmac=351f90dca30e149492e8311aa6fb071c6603f636497b0d5eaa8841ebadca2eb4; path=/; domain=cp143903-f.akamaihd.net; \r\nSet-Cookie: _alid_=OgZcl4MfcHGlfU/wKcdgUg==; path=/i//012/mp4/e/2014-12-04_21_00_00_enq_0174_,400,500,800,1200,.mp4.csmil/; domain=cp143903-f.akamaihd.net\r\n\r\n#EXTM3U\n#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=461000,RESOLUTION=480x270,CODECS=\"avc1.66.30, mp4a.40.2\"\nhttp://cp143903-f.akamaihd.net/i/012/mp4/e/2014-12-04_21_00_00_enq_0174_,400,500,800,1200,.mp4.csmil/index_0_av.m3u8?null=&id=AgBIAEiQzJwPLIdeq1TtNog05%2fxoLFnr7XwBzkt%2fownbcelxeg8u2bC831MJyKDEMpgL+HRj%2fQnw1A%3d%3d\n#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=561000,RESOLUTION=512x288,CODECS=\"avc1.66.30, mp4a.40.2\"\nhttp://cp143903-f.akamaihd.net/i/012/mp4/e/2014-12-04_21_00_00_enq_0174_,400,500,800,1200,.mp4.csmil/index_1_av.m3u8?null=&id=AgBIAEiQzJwPLIdeq1TtNog05%2fxoLFnr7XwBzkt%2fownbcelxeg8u2bC831MJyKDEMpgL+HRj%2fQnw1A%3d%3d\n#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=925000,RESOLUTION=", 8192, 0, NULL, NULL) = 1338
recvfrom(5, "640x360,CODECS=\"avc1.66.30, mp4a.40.2\"\nhttp://cp143903-f.akamaihd.net/i/012/mp4/e/2014-12-04_21_00_00_enq_0174_,400,500,800,1200,.mp4.csmil/index_2_av.m3u8?null=&id=AgBIAEiQzJwPLIdeq1TtNog05%2fxoLFnr7XwBzkt%2fownbcelxeg8u2bC831MJyKDEMpgL+HRj%2fQnw1A%3d%3d\n#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1325000,RESOLUTION=852x480,CODECS=\"avc1.77.30, mp4a.40.2\"\nhttp://cp143903-f.akamaihd.net/i/012/mp4/e/2014-12-04_21_00_00_enq_0174_,400,500,800,1200,.mp4.csmil/index_3_av.m3u8?null=&id=AgBIAEiQzJwPLIdeq1TtNog05%2fxoLFnr7XwBzkt%2fownbcelxeg8u2bC831MJyKDEMpgL+HRj%2fQnw1A%3d%3d\n#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=61000,CODECS=\"mp4a.40.2\"\nhttp://cp143903-f.akamaihd.net/i/012/mp4/e/2014-12-04_21_00_00_enq_0174_,400,500,800,1200,.mp4.csmil/index_0_a.m3u8?null=&id=AgBIAEiQzJwPLIdeq1TtNog05%2fxoLFnr7XwBzkt%2fownbcelxeg8u2bC831MJyKDEMpgL+HRj%2fQnw1A%3d%3d\n", 8192, 0, NULL, NULL) = 854
recvfrom(5, "\324~\201\200\0\1\0\3\0\0\0\0\3api\fradio-canada\2ca\0\0\1\0\1\300\f\0\5\0\1\0\0\7M\0\34\3san\7src-cbc\2ca\7edgekey\3net\0\3001\0\5\0\1\0\0>U\0\25\5e5627\1g\nakamaiedge\300H\300Y\0\1\0\1\0\0\0\5\0\4\27\t`\311", 2048, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.0.1")}, [16]) = 126
recvfrom(5, "@\32\201\200\0\1\0\2\0\1\0\0\3api\fradio-canada\2ca\0\0\34\0\1\300\f\0\5\0\1\0\0\7M\0\34\3san\7src-cbc\2ca\7edgekey\3net\0\3001\0\5\0\1\0\0>U\0\25\5e5627\1g\nakamaiedge\300H\300_\0\6\0\1\0\0\1\306\0001\3n0g\300a\nhostmaster\6akamai\3com\0T\253\\e\0\0\3\350\0\0\3\350\0\0\3\350\0\0\7\10", 1922, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.0.1")}, [16]) = 171
recvfrom(5, "HTTP/1.1 200 OK\r\nServer: Microsoft-IIS/7.5\r\nContent-Length: 368\r\nContent-Type: application/json\r\nAccess-Control-Allow-Headers: *\r\nAccess-Control-Allow-Origin: *\r\nX-Powered-By: ASP.NET\r\nETag: \"90aeefc1affecf1:0\"\r\nDate: Tue, 06 Jan 2015 04:03:20 GMT\r\nConnection: keep-alive\r\n\r\n{\"url\":\"http://cp143903-f.akamaihd.net/i/012/mp4/e/2014-12-04_21_00_00_enq_0174_,400,500,800,1200,.mp4.csmil/master.m3u8?hdnea=st=1420516997~exp=1420517012~acl=/i/012/mp4/e/2014-12-04_21_00_00_enq_0174_*~hmac=2876c31efe9ef9413854fd4791a5753a1c1e70f0086583dd537ab220e90aa8d0

so i am guessing the HTTPS validation methods are failing here.

qtoutv: timeout error

Once the bitrate is chosen for a group of episodes (download all episodes or download season episodes), a timeout may occur; here's the traceback:

Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 331, in _make_request
    httplib_response = conn.getresponse(buffering=True)
TypeError: getresponse() got an unexpected keyword argument 'buffering'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 333, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib64/python3.4/http/client.py", line 1172, in getresponse
    response.begin()
  File "/usr/lib64/python3.4/http/client.py", line 351, in begin
    version, status, reason = self._read_status()
  File "/usr/lib64/python3.4/http/client.py", line 313, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib64/python3.4/socket.py", line 371, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/requests/adapters.py", line 362, in send
    timeout=timeout
  File "/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 559, in urlopen
    _pool=self, _stacktrace=stacktrace)
  File "/usr/lib/python3.4/site-packages/requests/packages/urllib3/util/retry.py", line 245, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/lib/python3.4/site-packages/requests/packages/urllib3/packages/six.py", line 310, in reraise
    raise value
  File "/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 516, in urlopen
    body=body, headers=headers)
  File "/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 336, in _make_request
    self, url, "Read timed out. (read timeout=%s)" % read_timeout)
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='api.radio-canada.ca', port=80): Read timed out. (read timeout=15)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/eepp/dev/pytoutv/toutv/dl.py", line 95, in _do_request
    timeout=15, stream=stream)
  File "/usr/lib/python3.4/site-packages/requests/api.py", line 59, in get
    return request('get', url, **kwargs)
  File "/usr/lib/python3.4/site-packages/requests/api.py", line 48, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3.4/site-packages/requests/sessions.py", line 451, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3.4/site-packages/requests/sessions.py", line 557, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3.4/site-packages/requests/adapters.py", line 422, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='api.radio-canada.ca', port=80): Read timed out. (read timeout=15)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/eepp/dev/pytoutv/toutvqt/main_window.py", line 243, in _on_bitrate_chosen
    self.start_download_episodes(res_index, episodes, output_dir)
  File "/home/eepp/dev/pytoutv/toutvqt/main_window.py", line 217, in start_download_episodes
    qualities = episode.get_available_qualities()
  File "/home/eepp/dev/pytoutv/toutv/bos.py", line 468, in get_available_qualities
    playlist = toutv.dl.Downloader.get_episode_playlist(self, proxies)
  File "/home/eepp/dev/pytoutv/toutv/dl.py", line 139, in get_episode_playlist
    pl, cookies = Downloader.get_episode_playlist_cookies(episode, proxies)
  File "/home/eepp/dev/pytoutv/toutv/dl.py", line 127, in get_episode_playlist_cookies
    url = Downloader.get_episode_playlist_url(episode)
  File "/home/eepp/dev/pytoutv/toutv/dl.py", line 117, in get_episode_playlist_url
    timeout=15)
  File "/home/eepp/dev/pytoutv/toutv/dl.py", line 100, in _do_request
    raise toutv.exceptions.RequestTimeout(url, timeout)
toutv.exceptions.RequestTimeout: Request timeout (15 s for "http://api.radio-canada.ca/validationMedia/v1/Validation.html")

Fetch not working - 'NoneType' object has no attribute 'strip'

I think tou.tv made some recent changes to their protocol...

./toutv-cli.py search Deep
[...]
Episode:
Emission ID: 2297043829
Episode ID: 2302458066
Le monde parallèle:
Adrian et Martin entrent dans une cuisine parallèle, presque identique à la leur, mais beaucoup
plus sinistre.Comment réagir lorsqu’on rencontre son double?
[...]

./toutv-cli.py fetch -d ~/tou.tv --quality MAX 2297043829 2302458066
Emission and episode:
Deep - Le monde parallèle (S01E07)
Traceback (most recent call last):
File "./toutv-cli.py", line 389, in
app.run()
File "./toutv-cli.py", line 48, in run
args.func(args)
File "./toutv-cli.py", line 105, in command_fetch
self.fetch_episodes(args.emission, args.episode, args.directory, quality=args.quality, bitrate=args.bitrate)
File "./toutv-cli.py", line 283, in fetch_episodes
request = urllib2.Request(url, None, {"User-Agent" : client.IPHONE4_USER_AGENT})
File "/usr/lib/python2.7/urllib2.py", line 198, in init
self.__original = unwrap(url)
File "/usr/lib/python2.7/urllib.py", line 1056, in unwrap
url = url.strip()
AttributeError: 'NoneType' object has no attribute 'strip'

Version 3 discussions

Hi, I followed the installation for OS X : sudo pip3 install pytoutv. Everything is good.

Just want to know how to get access to EXTRA files (or at least 720p). I don't plan on testing, just want to get the version with 720p downloading!

"toutv --verbose" throws an exception

$ toutv -v
Traceback (most recent call last):
  File "/home/simark/src/pytoutv-env/bin/toutv", line 9, in <module>
    load_entry_point('pytoutv==2.3.1', 'console_scripts', 'toutv')()
  File "/home/simark/src/pytoutv/toutvcli/app.py", line 667, in run
    return app.run()
  File "/home/simark/src/pytoutv/toutvcli/app.py", line 90, in run
    if args.build_client:
AttributeError: 'Namespace' object has no attribute 'build_client'

paste url instead of searching

It would be nice to just paste-in an episode or show URL and have the application figure-out show and episode it by itself instead of using the CLI interface to search it.

get_flash_videos works like that and I like that.

For example, searching for the show 19-2 ended up being quite tedious because 19 and 2 appear in a lot of text. Ended up doing ./tou.tv-cli.py list | grep 19-2

Search results should include episode #

Search results include lots of details but lack the episode reference which is essential to download.

Perhaps include the same format as in the "list" option.

HTTP Error 500: Internal Server Error

Quand j'essaie de faire une recherche j'obtiens cette erreur :

[~/tmp/Tou.tv-console-application-master] ./toutv-cli.py search 19-2
Traceback (most recent call last):
File "./toutv-cli.py", line 379, in
app.run()
File "./toutv-cli.py", line 48, in run
args.func(args)
File "./toutv-cli.py", line 108, in command_search
self.search(' '.join(args.query))
File "./toutv-cli.py", line 111, in search
searchresult = self.toutvclient.search_terms(query)
File "/home/cbourque/tmp/Tou.tv-console-application-master/toutv/client.py", line 429, in search_terms
return self.transport.search_terms(query)
File "/home/cbourque/tmp/Tou.tv-console-application-master/toutv/client.py", line 367, in search_terms
searchresults_dto = self._do_query("SearchTerms", {"query": query})
File "/home/cbourque/tmp/Tou.tv-console-application-master/toutv/client.py", line 318, in _do_query
json_decoded = self.json_decoder.decode(urllib2.urlopen(request).read())
File "/usr/lib64/python2.7/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib64/python2.7/urllib2.py", line 406, in open
response = meth(req, response)
File "/usr/lib64/python2.7/urllib2.py", line 519, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib64/python2.7/urllib2.py", line 444, in error
return self._call_chain(_args)
File "/usr/lib64/python2.7/urllib2.py", line 378, in _call_chain
result = func(_args)
File "/usr/lib64/python2.7/urllib2.py", line 527, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 500: Internal Server Error

Release 1.0 ?

This works well enough for me, I think it would be great to tag the current tree as 1.0, based on semver.org logical principals of major/minor/patch releases.

Can't install version 2 with pip under Debian

Oï!

I can get to install version 2 under Debian Linux...

Here is what I get when using pip:

root@zapata:/home/emiliano/.pytoutv/pytoutv# pip install pytoutv
Downloading/unpacking pytoutv
  Downloading pytoutv-2.1.1.tar.gz
  Running setup.py egg_info for package pytoutv
    Sorry, pytoutv needs Python 3.3+
    Complete output from command python setup.py egg_info:
    Sorry, pytoutv needs Python 3.3+

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/pytoutv
Storing complete log in /root/.pip/pip.log

And yet, python3.3 is installed:

root@zapata:/home/emiliano/.pytoutv/pytoutv# apt-get install python3.3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3.3 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

The right dependencies (Python3 ones) are installed.

I'm not used to use pip, but I think the problem might come from the fact that pip tries to use the Python 2 deps by default and thus fails because they are not the required Python3 deps. If it is simply me not using pip right, maybe you should specify how to in the README.

Using setup.py works though.

I kinda miss the simple "clone & run" version 1.

(but Yay! for the cleaner rewrite!)

Enhancement: better cope with network errors

Since the dawn of time, mankind has used stress in a constructive manner. It has helped him capture animals for food as well as escape from danger. In modern society, however, sources of stress have become ubiquitous. They are now mostly more a nuisance and a health hazard than an advantage. Using pytoutv should not contribute to elevate our global level of stress. To the contrary, it should be a relaxing and revigorating experience.

It turns out that right now, downloads (at least for me) are relatively frequently interrupted because of various network errors and timeouts. For example, I just got this twice:

Découverte.S2014E19.Le.Cap.1325kbps.ts   231.1 MiB   137/258 [##################################------------------------------]  53%
Unknown error: ('Connection aborted.', gaierror(-2, 'Name or service not known'))

This makes downloading a big file (e.g. Découverte in HQ, ~400 megabytes) an unacceptable moment of worrying: will my download reach completion or not?

pytoutv should do either or both of:

  1. retry downloading a failed section a few times before concluding that all hope is lost;
  2. allow resuming a cancelled/interrupted/failed download.

I am sure that 1 is not too hard to implement., but 2 should be possible as well. I don't know if it would be possible to resume a partial download at the right position using only the partial ts file, or if we'd need an index on the side to remember where we left off.

Unknown error: name 'seach' is not defined

Quand on tente de chercher une émission, on mentionne que "seach" n'existe pas.

monOrdinateur:bin monUsername$ python3.4 toutv search "Infoman"
Unknown error: name 'seach' is not defined

Made pull request with the corrected variable name.

Merci!

UnicodeEncodeError when trying to download on Ubuntu 14.04

I just tried to download an episode in an Ubuntu 14.04 container:

(env) root@06dca589bdcd:/pytoutv# toutv fetch Infoman S17E10
Unknown exception: <class 'UnicodeEncodeError'>: 'ascii' codec can't encode character '\xc9' in position 24: ordinal not in range(128)
Traceback (most recent call last):
  File "/pytoutv/toutvcli/app.py", line 94, in run
    args.func(args)
  File "/pytoutv/toutvcli/app.py", line 322, in _command_fetch
    bitrate=bitrate, overwrite=args.force)
  File "/pytoutv/toutvcli/app.py", line 594, in _fetch_episode_name
    bitrate=bitrate, overwrite=overwrite)
  File "/pytoutv/toutvcli/app.py", line 573, in _fetch_episode
    self._dl.download()
  File "/pytoutv/toutv/dl.py", line 290, in download
    self._init_download()
  File "/pytoutv/toutv/dl.py", line 142, in _init_download
    if not self._overwrite and os.path.exists(self._output_path):
  File "/env/lib/python3.4/genericpath.py", line 19, in exists
    os.stat(path)
UnicodeEncodeError: 'ascii' codec can't encode character '\xc9' in position 24: ordinal not in range(128)

streaming http error not found

Hi, it's the second time I saw this bug.

"Emission and episode:
Enquête - L’affaire Rob Ford (S2013E10)
Fetching video with bitrate 925000 bit/s
Downloading 260 segments...
Traceback (most recent call last):########## ] 56%
File "../toutv-cli.py", line 548, in
app.run()
File "../toutv-cli.py", line 58, in run
args.func(args)
File "../toutv-cli.py", line 131, in command_fetch
self.fetch_episode(args.emission, args.episode, args.directory, quality=args.quality, bitrate=args.bitrate)
File "../toutv-cli.py", line 414, in fetch_episode
ts_file = urllib2.urlopen(request).read()
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 410, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 448, in error
return self._call_chain(_args)
File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(_args)
File "/usr/lib/python2.7/urllib2.py", line 531, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found
"

The downloading always stop at 56%.
Do you have some idea?

Retry option for failed downloads

It would be nice to be able to right-click on a failed download and hit retry to restart it.

Bonus points if the already completely downloaded chunks are not re-downloaded.

Debian package

I've filed ITP #738275 to get this packaged in Debian. If you would prefer package/maintain it yourself, I'll happily reassign the bug.

Simplify READMEs

pytoutv READMEs are really huge.

I suggest minimizing them the following way:

  • move the top public API/CBFT-DT disclaimer stuff to a new Disclaimer section at the very bottom of the README
  • remove historical note about Tou.tv-console-application: it's been more than one year now, and people do not remember/care about the dark ages 😉
  • fix the Mac OS X section (incomplete Markdown)
  • remove Using setup.py section: not needed since people will almost always use the pip method, which is simpler
  • remove Library section: not ready yet anyway
  • replace heavy CLI examples by asciicasts, which also shows colors
  • remove Bugs and Contributing sections: it's pretty obvious that GitHub issues/pull requests are the preferred ways to contribute
  • rename Python workflow section to Developers (or Contributing, again)
  • remove Semantic versioning section: users do not really care about that, it's only for developers
  • remove Contributors section: contributors are available in the [https://github.com/bvanheu/pytoutv/graphs/contributors](contributors section) of the project

n'est pas disponible dans votre pays

Hi, for the infoman S15E12 episode, I'm getting this error : Unknown error: Le contenu sélectionné n'est pas disponible dans votre pays

Of course, I've checked in the browser (chromium) and the video play normaly.
Checked the ip geolocation for my ip and it's still Québec.

I'll post back tommorow morning if it work-out by itself. Is there any debug command so I can provide a better idea of the problem...if it's not on my side only.

Thanks
Philippe

Codec can't decode byte error

Hi everyone :)

I'm a noob, so please bear with me !!! Been getting this error lately (I tried uninstalling and installing back pytoutv with pip3 on OSX Yosemite, python 3.5.1 installed, but I still get this error. I installed it on my old ubuntu server and it works fine... what did I do on OSX so it does''T work anymore...that I don't know !!)

<class 'UnicodeDecodeError'>: 'utf-8' codec can't decode byte 0x97 in position 34: invalid start byte

Can anybody help me ?

Thanks.

Chester.

Lists: remove trailing ':' after IDs

The CLI list currently looks like this:

...
2424966275: Sur le Yangzi
2339675742: Synthétiseur
2296651836: Tabula Rasa
2422158697: The pamplemousse
2424966628: Ti-Mé Show
2424966325: Toi et moi
2424966549: Toi, t'es-tu Lucky?
...

What's often done is double-clicking the ID, which also selects the trailing : character with some terminal emulators, and middle-clicking after having typed toutv list to list the episodes of this show. Then the trailing : should not be pasted, so it should be removed from the list output, because it's very annoying.

Remove illegal chars from output filename

I encountered a case where a title contains a ? character, which is reserved in Unix and Illegal in Windows.

To reproduce:

PS C:\Code\Toutv> toutv-cli.py fetch -q MAX Infoman S14E14
Emission and episode:
        Infoman - Quest-il advenu de?     (S14E14)
Fetching video with bitrate 1324000 bit/s
Downloading 130 segments...
Traceback (most recent call last):
  File "toutv-cli.py", line 548, in <module>
    app.run()
  File "toutv-cli.py", line 58, in run
    args.func(args)
  File "toutv-cli.py", line 131, in command_fetch
    self.fetch_episode(args.emission, args.episode, args.directory, quality=args.quality, bitrate=args.bitrate)
  File "toutv-cli.py", line 410, in fetch_episode
    output_file = open(os.path.join(os.path.expanduser(directory), emission.Title + "-" + episode.Title + ".ts"), "wb")`

Read resolution from m3u8

The m3u8 lists the resolution along with the bitrate. We should use it to display in the bitrate chooser, instead of hardcoded values.

Example:

EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=3124000,RESOLUTION=1280x720,CODECS="avc1.77.30, mp4a.40.2"

Improve quality selection

In the settings there should be a scroll down item to choose what quality to download. I suggest the following choices:

  • Ask every time
  • Maximum bitrate
  • Average bitrate
  • Minimum bitrate

Tou.tv EXTRA fetching

Hi all,

I am trying to fetch content from the EXTRA section of Tou.TV. I saw a previous post discussing the issue and I tried to find what I had to input in my Terminal to get this to work.

So far, I have tried to enter the following command line:
toutv login -u [email protected] -p xxx

My terminal returns the following message:
usage: toutv [-h] [-V] {list,info,search,fetch} ...
toutv: error: argument command: invalid choice: 'login' (choose from 'list', 'info', 'search', 'fetch')

So I guess I am missing something somewhere to get this to work.

Just wanted to tell you that I am able to fetch videos from the actual Tou.TV website without any problem, thanks for this great tool!

Any help is appreciated!

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.