@@ -62,9 +62,9 @@ Parsing of the html source will be done using HTMLement witch is integrated into
6262 url = url_constructor(" /mobile/category.html" )
6363 resp = urlquick.get(url, headers = {" Cookie" : " COOKIE_DEVICE=mobile" })
6464
65- # Filter source down to needed section by giving the name and
66- # attributes of the element containing the required data
67- # It is a lot faster to limit the parser to required section
65+ # Filter source down to required section by giving the name and
66+ # attributes of the element containing the required data.
67+ # It's a lot faster, to limit the parser to required section.
6868 root_elem = resp.parse(u " ul" , attrs = {" id" : " category_listing" })
6969
7070 # Parse each category
@@ -77,16 +77,16 @@ Parsing of the html source will be done using HTMLement witch is integrated into
7777 # Find the video count 'span' tag
7878 vidcount = elem.find(" span" ).text
7979
80- # Set label with video count added
80+ # Set label with video count added.
8181 item.label = " %s (%s )" % (a_tag.text, vidcount)
8282
83- # This will set the callback that will be called when listitem is activated
84- # 'video_list' is the route callback function that we will create later
83+ # This will set the callback that will be called when listitem is activated.
84+ # 'video_list' is the route callback function that we will create later.
8585 # The 'url' argument is the url of the category that will be passed
86- # to the 'video_list' callback
86+ # to the 'video_list' callback.
8787 item.set_callback(video_list, url = a_tag.get(" href" ))
8888
89- # Return the listitem as a generator
89+ # Return the listitem as a generator.
9090 yield item
9191
9292 Now we can create the video parser callback that will return playable listitems.
@@ -97,7 +97,7 @@ And since this is another function that will return listitems, it will be regist
9797
9898 @Route.register
9999 def video_list (plugin , url ):
100- # Request the online resource
100+ # Request the online resource.
101101 url = url_constructor(url)
102102 resp = urlquick.get(url)
103103 root_elem = resp.parse(" div" , attrs = {" id" : " browse_main" })
@@ -106,33 +106,33 @@ And since this is another function that will return listitems, it will be regist
106106 for elem in root_elem.iterfind(u " .//div[@class='video_i']" ):
107107 item = Listitem()
108108
109- # Set the thumbnail image of the video
109+ # Set the thumbnail image of the video.
110110 item.art[" thumb" ] = elem.find(" .//img" ).get(" src" )
111111
112- # Extract url from first 'a' element and remove it from source tree
113- # This makes it easier to extract 'artist' and 'song' names later
112+ # Extract url from first 'a' element and remove it from source tree.
113+ # This makes it easier to extract 'artist' and 'song' names later.
114114 a_tag = elem.find(" a" )
115115 url = a_tag.get(" href" )
116116 elem.remove(a_tag)
117117
118- # Set title as 'artist - song'
118+ # Set title as 'artist - song'.
119119 span_tags = tuple (node.text for node in elem.findall(" .//span" ))
120120 item.label = " %s - %s " % span_tags
121121 item.info[" artist" ] = [span_tags[0 ]]
122122
123- # 'play_video' is the resolver callback function that we will create later
123+ # 'play_video' is the resolver callback function that we will create later.
124124 # The 'url' argument is the url of the video that will be passed
125- # to the 'play_video' resolver callback
125+ # to the 'play_video' resolver callback.
126126 item.set_callback(play_video, url = url)
127127
128- # Return the listitem as a generator
128+ # Return the listitem as a generator.
129129 yield item
130130
131- # Extract the next page url if one exists
131+ # Extract the next page url if one exists.
132132 next_tag = root_elem.findall(" .//div[@class='pagination']/a" )
133133 if next_tag and next_tag[- 1 ].text.startswith(" next" ):
134- # This will return a listitem that will link back to this
135- # callback function with url of the next page of content
134+ # This will return a listitem, that will link back to this
135+ # callback function with the url of the next page of content.
136136 yield Listitem.next_page(url = next_tag[- 1 ].get(" href" ))
137137
138138 Lastly is the :class: `Resolver<codequick.resolver.Resolver> ` callback and as so, it will need to be registered as one.
@@ -145,7 +145,7 @@ This callback is expected to return a playable video url. The first argument tha
145145 @Resolver.register
146146 def play_video (plugin , url ):
147147 # Sence http://metalvideo.com uses enbeaded youtube videos,
148- # we can use 'plugin.extract_source' to extract the video url
148+ # we can use 'plugin.extract_source' to extract the video url.
149149 url = url_constructor(url)
150150 return plugin.extract_source(url)
151151
0 commit comments