<< | Index | >>
de and fr
There are not pi updates list (yet ?) in compendium.ch.
There are not any feed.
And,
It seems that these pages check cookie and session-id (oder user info).
It redirect direct access by agent to start page(default.asx).
main flow for text_info at import_daily.
1. jobs/import_daily 2. Updater#run 3. TextInfoPlugin#import_news 4. TextInfoPlugin#textinfo_news (ODDB.config.text_info_newssource) 5. TextInfoPlugin#import_name 6. TextInfoPlugin#search_product 7. TextInfoPlugin#search 8. TextInfoPlugin#import_products 9. TextInfoPlugin#import_product 10. TextInfoPlugin#download_info (de, fr, before this method, check only DE page) 11. TextInfoPlugin#update_product 12. TextInfoPlugin#update_fachinfo 13. TextInfoPlugin#update_patinfo 14. TextInfoPlugin#replace
updated text_info_news
text_info_newssource: 'http://compendium.ch/update/subject/security/1/de'
def textinfo_news agent=init_agent
url = ODDB.config.text_info_newssource \
or raise 'please configure ODDB.config.text_info_newssource to proceed'
# as entry point
agent.get('http://compendium.ch/default.aspx'). \
link_with(:href => /prof\/de/).click
page = agent.get(url)
list = Hash.new{|h,k| h[k] = {}}
page.search(
'//span[starts-with(@id, "ctl00_MainContent_UcSecurityNews_dlNews_")]'
).map do |span|
case span['id']
when /_ctl(\d{2})_Label1/
index = $1.to_s
if span.child.text =~ /\d{2}\.\d{2}\.\d{2}/
begin
list[:date][index] = Date.strptime(span.child.text, '%d.%m.%y')
rescue ArgumentError
end
end
when /_ctl(\d{2})_Label4/
unless span.child.text.empty?
list[:text][$1.to_s] = span.child.text
end
end
end
names = []
unless list.empty?
list[:date].each_pair do |index, date|
if date == Date.today and
list[:text][index]
names << list[:text][index]
end
end
end
names
end
# bin/admin ch.oddb> TextInfoPlugin.new(self).textinfo_news -> # debug-output [1] 1.9.3-p194(#<ODDB::TextInfoPlugin>)> names.length => 2 [2] 1.9.3-p194(#<ODDB::TextInfoPlugin>)> names => ["Cetuximab", "Adalimumab"]