Tree @5315caf (Download .tar.gz)
- ..
- __init__.py
- abou.py
- about.py
- affilorama.py
- ahmia.py
- anarchy101.py
- angel.py
- archive.py
- arduino.py
- ariva.py
- armorgames.py
- askfm.py
- audiob.py
- audioboo.py
- authorstream.py
- autospies.py
- badoo.py
- bandcamp.py
- bebee.py
- behance.py
- bennugd.py
- betblog.py
- bitbucket.py
- bitcointa.py
- bitcointalk.py
- bitly.py
- bitrated.py
- blackplanet.py
- blip.py
- blogmarks.py
- blogspot.py
- bookofmatches.py
- boonex.py
- bordom.py
- boxedup.py
- breakcom.py
- bubok.py
- bucketlistly.py
- buddypic.py
- burbuja.py
- burdastyle.py
- buzznet.py
- cafemom.py
- canva.py
- carbonmade.py
- cardinghispano.py
- cardingmx.py
- cardomain.py
- care2.py
- cartodb.py
- cash.py
- castroller.py
- causes.py
- ccm.py
- ccsinfo.py
- chess.py
- cockos.py
- codecademy.py
- codementor.py
- coderwall.py
- coinbase.py
- colourlovers.py
- connectingsingles.py
- contently.py
- couchsurfing.py
- crokes.py
- crowdin.py
- cryptofresh.py
- dailymotion.py
- datpiff.py
- deviantart.py
- digitalspy.py
- disqus.py
- doodle.py
- douban.py
- dreamstime.py
- dribbble.py
- drugbuyersforum.py
- drupal.py
- dzone.py
- ebay.py
- echatta.py
- ehow.py
- eightbitme.py
- ello.py
- elmundo.py
- emoneyspace.py
- enfemenino.py
- ethereum.py
- etsy.py
- eyeem.py
- f6s.py
- facebook.py
- facesaerch.py
- fanpop.py
- fark.py
- favstar.py
- fiverr.py
- flickr.py
- flixster.py
- foodspotting.py
- forobtc.py
- forocoches.py
- foroptc.py
- foros24h.py
- forosperu.py
- forospyware.py
- fotolog.py
- foursquare.py
- freelancer.py
- freerepublic.py
- gamesheep.py
- gametracker.py
- gapyear.py
- gather.py
- geeksphone.py
- genspot.py
- getlocalization.py
- getsatisfaction.py
- github.py
- goblinrefuge.py
- goodreads.py
- googleplus.py
- gravatar.py
- gsmspain.py
- hi5.py
- houzz.py
- htcmania.py
- hubpages.py
- ibosocial.py
- identica.py
- ifunny.py
- imgur.py
- infotelefonica.py
- inkonsky.py
- instagram.py
- instructables.py
- intfiction.py
- islamicawakening.py
- issuu.py
- ivoox.py
- jamiiforums.py
- kali.py
- kanogames.py
- karmacracy.py
- keybase.py
- kickstarter.py
- kimatel.py
- kinja.py
- kiwi.py
- klout.py
- kongregate.py
- kupika.py
- lastfm.py
- leakforums.py
- linkedin.py
- listaspam.py
- livejournal.py
- looki.py
- losviajeros.py
- marca.py
- matchdoctor.py
- mcneel.py
- mediavida.py
- medium.py
- meneame.py
- mercadolibre.py
- metacafe.py
- meteor.py
- mig.py
- migente.py
- miiverse.py
- minecraft.py
- moneymaker.py
- mozilla.py
- musicasacra.py
- myeloma.py
- myfitnesspal.py
- myspace.py
- nairaland.py
- netlog.py
- netvibes.py
- newgrounds.py
- notablug.py
- occupywallst.py
- odnoklassniki.py
- okcupid.py
- onename.py
- openbugbounty.py
- openframeworks.py
- openstreetmap.py
- papaly.py
- pastebin.py
- patreon.py
- pearltrees.py
- peerbackers.py
- periscope.py
- pgpmit.py
- phishtank.py
- photobucket.py
- pixinsight.py
- pixls.py
- pjrc.py
- pokerred.py
- pokerstrategy.py
- pornhub.py
- proboards.py
- px500.py
- pz.py
- qq.py
- quartermoonsaloon.py
- rankia.py
- rapid7.py
- rapid_i.py
- ratemypoo.py
- realcarders.py
- rebelmouse.py
- reddit.py
- redtube.py
- researchgate.py
- reverbnation.py
- ripenear.py
- rojadirecta.py
- ruby.py
- sarahah.py
- scribd.py
- seatwish.py
- sencha.py
- sidereel.py
- singletrackworld.py
- skype.py
- slashdot.py
- slideshare.py
- smartcitizen.py
- smugmug.py
- soundcloud.py
- soup.py
- sourceforge.py
- spaniards.py
- spoj.py
- spotify.py
- spreaker.py
- squidoo.py
- steamcommunity.py
- steemit.py
- steinberg.py
- streakgaming.py
- taringa.py
- teamtreehouse.py
- techcrunch.py
- technorati.py
- thehoodup.py
- thesims.py
- thestudentroom.py
- theverge.py
- tipme.py
- tradimo.py
- trakt.py
- translate_hola.py
- trip.py
- tripadvisor.py
- tripit.py
- trulia.py
- tumblr.py
- tune.py
- tuporno.py
- twicsy.py
- twitch.py
- twitter.py
- twoplustwo.py
- typepad.py
- unioncarder.py
- ustream.py
- v7n.py
- venmo.py
- vexforum.py
- viddler.py
- videohelp.py
- vimeo.py
- virustotal.py
- vk.py
- warriorforum.py
- webtv.py
- wikia.py
- wikipediaar.py
- wikipediaca.py
- wikipediade.py
- wikipediaen.py
- wikipediaes.py
- wikipediaeu.py
- wikipediafr.py
- wikipediapt.py
- winamp.py
- wishlistr.py
- witty.py
- wykop.py
- xanga.py
- xing.py
- xtube.py
- younow.py
- youtube.py
- zabbix.py
- zentyal.py
- zotero.py
youtube.py @5315caf — raw · history · blame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | # !/usr/bin/python
# -*- coding: cp1252 -*-
#
##################################################################################
#
# Copyright 2016 FĂ©lix Brezo and Yaiza Rubio (i3visio, [email protected])
#
# This program is part of OSRFramework. You can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##################################################################################
import argparse
import json
import re
import sys
import urllib2
import osrframework.utils.browser as browser
from osrframework.utils.platforms import Platform
class Youtube(Platform):
'''
A <Platform> object for Youtube.
'''
def __init__(self):
'''
Constructor...
'''
self.platformName = "Youtube"
self.tags = ["social", "video"]
# Base URL
self.baseURL = "http://youtube.com/"
########################
# Defining valid modes #
########################
self.isValidMode = {}
self.isValidMode["phonefy"] = False
self.isValidMode["usufy"] = True
self.isValidMode["searchfy"] = True
######################################
# Search URL for the different modes #
######################################
# Strings with the URL for each and every mode
self.url = {}
#self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>"
self.url["usufy"] = "https://www.youtube.com/user/" + "<usufy>" + "/about"
self.url["searchfy"] = "https://www.youtube.com/results?filters=channel&lclk=channel&search_query=" + "<searchfy>"
######################################
# Whether the user needs credentials #
######################################
self.needsCredentials = {}
#self.needsCredentials["phonefy"] = False
self.needsCredentials["usufy"] = False
self.needsCredentials["searchfy"] = False
#################
# Valid queries #
#################
# Strings that will imply that the query number is not appearing
self.validQuery = {}
# The regular expression '.+' will match any query.
#self.validQuery["phonefy"] = ".*"
self.validQuery["usufy"] = "[^@, ]+"
self.validQuery["searchfy"] = ".+"
###################
# Not_found clues #
###################
# Strings that will imply that the query number is not appearing
self.notFoundText = {}
#self.notFoundText["phonefy"] = []
self.notFoundText["usufy"] = ["Este canal no existe.", "channel-empty-message banner-message"]
self.notFoundText["searchfy"] = []
#########################
# Fields to be searched #
#########################
self.fieldsRegExp = {}
# Definition of regular expressions to be searched in phonefy mode
#self.fieldsRegExp["phonefy"] = {}
# Example of fields:
#self.fieldsRegExp["phonefy"]["i3visio.location"] = ""
# Definition of regular expressions to be searched in usufy mode
self.fieldsRegExp["usufy"] = {}
# Example of fields:
#self.fieldsRegExp["usufy"]["i3visio.location"] = ""
self.fieldsRegExp["usufy"]["subscribers"] = {"start": "<span class=\"yt-subscription-button-subscriber-count-branded-horizontal subscribed\" title=\"", "end": "\">"}
self.fieldsRegExp["usufy"]["@total_views"] = {"start": "</li>.*<li class=\"about-stat \">.*<b>", "end": "</b>"}
self.fieldsRegExp["usufy"]["i3visio.date"] = {"start": "<li class=\"about-stat joined-date\">", "end": "</li>"}
self.fieldsRegExp["usufy"]["i3visio.profile.facebook"] = {"start": "alt=\"https://www.facebook.com/", "end": "\""}
self.fieldsRegExp["usufy"]["i3visio.profile.twitter"] = {"start": "alt=\"http://www.twitter.com/#!/", "end": "\""}
self.fieldsRegExp["usufy"]["i3visio.profile.instagram"] = {"start": "alt=\"http://instagram.com/", "end": "\""}
self.fieldsRegExp["usufy"]["i3visio.alias"] = '<meta itemprop="name" content="([^\"]+)\"'
# Description
self.fieldsRegExp["usufy"]["i3visio.text"] = {"start": "<div class=\"about-description branded-page-box-padding\" >", "end": "</div>"}
# Definition of regular expressions to be searched in searchfy mode
self.fieldsRegExp["searchfy"] = {}
self.searchfyAliasRegexp = '<div class="yt-lockup-byline"><a href="([^\"]+)" class="yt-uix-sessionlink g-hovercard spf-link "'
# Example of fields:
#self.fieldsRegExp["searchfy"]["i3visio.location"] = ""
################
# Fields found #
################
# This attribute will be feeded when running the program.
self.foundFields = {}
def createURL(self, word, mode="phonefy"):
'''
Method to create the URL replacing the word in the appropriate URL.
:param word: Word to be searched.
:param mode: Mode to be executed.
:return: The URL to be queried.
'''
# Youtube has two different types of profiles: channels and users
if "/user/" in word:
alias = word[6:]
else:
alias = word
try:
if mode == "base":
if word[0] == "/":
return self.baseURL+word[1:], alias
else:
return self.baseURL+word, alias
else:
try:
return self.url[mode].replace("<"+mode+">", word.replace(' ', '+')), alias
except:
pass
except:
pass
# TO-DO: BaseURLNotFoundExceptionThrow base URL not found for the mode.
|