def getVideos( self ) : # # Init # # # Get HTML page... # httpCommunicator = HTTPCommunicator() url = "http://channel9.msdn.com/Browse/AllContent?page=%u" % self.current_page htmlData = httpCommunicator.get( url ) # # Parse response... # soupStrainer = SoupStrainer( "ul", { "class" : "entries" } ) beautifulSoup = BeautifulSoup( htmlData, soupStrainer, convertEntities=BeautifulSoup.HTML_ENTITIES ) # # Parse movie entries... # ul_entries = beautifulSoup.find ( "ul", { "class" : "entries" } ) li_entries = ul_entries.findAll ("li", recursive=False) for li_entry in li_entries: # Thumbnail... div_entry_image = li_entry.find( "div", { "class" : "entry-image" } ) thumbnail = div_entry_image.find( "img", { "class" : "thumb" } ) ["src"] # Title div_entry_meta = li_entry.find( "div", { "class" : "entry-meta" } ) a_title = div_entry_meta.find( "a", { "class" : "title" } ) title = a_title.string # Video page video_page_url = a_title[ "href" ] # Genre (date)... div_data = div_entry_meta.find( "div", { "class" : "data" } ) span_class_date = div_data.find( "span", { "class" : "date" } ) genre = span_class_date.string # Plot div_description = div_entry_meta.find( "div", { "class" : "description" } ) plot = div_description.string # Add to list... listitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", thumbnailImage=thumbnail ) listitem.setInfo( "video", { "Title" : title, "Studio" : "Microsoft Channel 9", "Plot" : plot, "Genre" : genre } ) plugin_play_url = '%s?action=play&video_page_url=%s' % ( sys.argv[ 0 ], urllib.quote_plus( video_page_url ) ) xbmcplugin.addDirectoryItem( handle=int(sys.argv[ 1 ]), url=plugin_play_url, listitem=listitem, isFolder=False) # Next page entry... listitem = xbmcgui.ListItem (__language__(30503), iconImage = "DefaultFolder.png", thumbnailImage = os.path.join(self.IMAGES_PATH, 'next-page.png')) xbmcplugin.addDirectoryItem( handle = int(sys.argv[1]), url = "%s?action=list-all&page=%i" % ( sys.argv[0], self.current_page + 1 ), listitem = listitem, isFolder = True) # Disable sorting... xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def getVideos( self ) : # # Init # # # Get HTML page... # httpCommunicator = HTTPCommunicator() url = "http://channel9.msdn.com/Browse/Series?page=%u" % self.current_page htmlData = httpCommunicator.get( url ) # # Parse response... # soupStrainer = SoupStrainer( "ul", { "class" : "entries" } ) beautifulSoup = BeautifulSoup( htmlData, soupStrainer, convertEntities=BeautifulSoup.HTML_ENTITIES ) # # Parse shows... # li_entries = beautifulSoup.findAll ("li") for li_entry in li_entries: # Thumbnail... div_entry_image = li_entry.find( "div", { "class" : "entry-image" } ) thumbnail = div_entry_image.find( "img", { "class" : "thumb" } ) ["src"] # Title div_entry_meta = li_entry.find( "div", { "class" : "entry-meta" } ) a_title = div_entry_meta.find( "a", { "class" : "title" } ) title = a_title.string # Series page URL series_url = a_title[ "href" ] # Plot div_description = div_entry_meta.find( "div", { "class" : "description" } ) plot = div_description.string # Add to list... listitem = xbmcgui.ListItem( title, iconImage="DefaultFolder.png", thumbnailImage=thumbnail ) plugin_list_show = '%s?action=list-series&series-url=%s' % ( sys.argv[ 0 ], urllib.quote_plus( series_url ) ) xbmcplugin.addDirectoryItem( handle=int(sys.argv[ 1 ]), url=plugin_list_show, listitem=listitem, isFolder=True) # Next page entry... ul_paging = beautifulSoup.find( "ul", { "class" : "paging" } ) if ul_paging : if ul_paging.find( "li", { "class" : "next" } ) : listitem = xbmcgui.ListItem (xbmc.getLocalizedString(30503), iconImage = "DefaultFolder.png", thumbnailImage = os.path.join(self.IMAGES_PATH, 'next-page.png')) xbmcplugin.addDirectoryItem( handle = int(sys.argv[1]), url = "%s?action=browse-series&page=%i" % ( sys.argv[0], self.current_page + 1 ), listitem = listitem, isFolder = True) # Disable sorting... xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def getVideos( self ) : # # Init # # # Get HTML page... # httpCommunicator = HTTPCommunicator() url = "http://channel9.msdn.com/Browse/Tags?page=%u" % self.current_page htmlData = httpCommunicator.get( url ) # # Parse response... # soupStrainer = SoupStrainer( "div", { "class" : "tab-content" } ) beautifulSoup = BeautifulSoup( htmlData, soupStrainer, convertEntities=BeautifulSoup.HTML_ENTITIES ) # # Parse tags... # ul_columns = beautifulSoup.findAll( "ul", { "class" : "default column" } ) for ul_column in ul_columns : li_entries = ul_column.findAll ("li") for li_entry in li_entries: a_tag = li_entry.a # Title title = a_tag.string # Tag page URL tag_url = a_tag[ "href" ] # Add to list... listitem = xbmcgui.ListItem( title, iconImage="DefaultFolder.png" ) plugin_list_show = '%s?action=list-tag&tag-url=%s' % ( sys.argv[ 0 ], urllib.quote_plus( tag_url ) ) xbmcplugin.addDirectoryItem( handle=int(sys.argv[ 1 ]), url=plugin_list_show, listitem=listitem, isFolder=True) # Next page entry... ul_paging = beautifulSoup.find( "ul", { "class" : "paging" } ) if ul_paging : if ul_paging.find( "li", { "class" : "next" } ) : listitem = xbmcgui.ListItem (__language__(30503), iconImage = "DefaultFolder.png", thumbnailImage = os.path.join(self.IMAGES_PATH, 'next-page.png')) xbmcplugin.addDirectoryItem( handle = int(sys.argv[1]), url = "%s?action=browse-tags&page=%i" % ( sys.argv[0], self.current_page + 1 ), listitem = listitem, isFolder = True) # Disable sorting... xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )