lib/grabepg/grab_tvsou.rb in grab_epg-0.1.8 vs lib/grabepg/grab_tvsou.rb in grab_epg-0.1.9
- old
+ new
@@ -42,11 +42,15 @@
return "http://m.tvsou.com/index.asp" if type.eql?("mobile")
end
def get_data_year_month_day(time)
- return {time:"#{time.year}-#{time.month}-#{time.day}",date:"#{@grabbase.conversion_what_day(time.wday)}(#{time.month}-#{time.day})"}
+ month = time.month.to_s
+ if month.length<2
+ month = "0"+month
+ end
+ return {time:"#{time.year}-#{time.month}-#{time.day}",date:"#{@grabbase.conversion_what_day(time.wday)}(#{month}-#{time.day})"}
end
#获取时间
#start_time 时间起始点
#use_time 天数
@@ -134,11 +138,11 @@
doc.css('div[class="time"]')[0].css("li[class='gray']").each do |schedule|
begin
_dispose = schedule.content
_dispose_show =schedule.css("span")[0].text
time = _dispose.gsub(_dispose_show,"")
- _url = @site + schedule.css('a')[0].get_attribute("href") if schedule.css('a')[0]
+ _url = @site+"/" + schedule.css('a')[0].get_attribute("href") if schedule.css('a')[0]
schedules << {time:time,schedule_name:_dispose_show.delete(" 剧情"),url:_url}
now = time.gsub(":","").to_i
if((now-last_time)<5)
schedules.delete(last_schedule)
end
@@ -151,9 +155,13 @@
ret.merge!({url[:date]=>schedules})
end
end
return ret
end
+
+
+
+
#解析节目详情页面
def dispose_show_info(url)
doc = @grabbase.get_doc_with_proxy(@proxy_list,url)
show_name = doc.css('div[class="tv_info_top"]')[0].content
\ No newline at end of file