view · edit · sidebar · attach · print · history

20121203-update-text-info-updater

<< | Index | >>


Summary

  • Update TextInfoPlugin

Commits

Index


Update text info plugin

search with company name.

ch.oddb> TextInfoPlugin.new(self).textinfo_news
-> ["Boehringer Ingelheim (Schweiz) GmbH", "Helvepharm AG"]
oddb.yaml
text_info_newssource: 'http://www.documed.ch/de/xml/fastonline.rss.php'
text_info_newssource2: 'http://compendium.ch/update/subject/security/1/de'
text_info_searchform: 'http://classic.compendium.ch/Search.aspx?lang=de'
text_info_searchform2: 'http://compendium.ch/search/de'

compendium.ch settings

Suchmuds
<input id="ctl00_MainContent_rblMonographie_1" type="radio" checked="checked" value="1" name="ctl00$MainContent$rblMonographie">
<label for="ctl00_MainContent_rblMonographie_1">Fachinformationen</label>
cookie (from request header)
dm.kompendium=langage=DE&contentLangage=DE&GLN=1&Username=xxxxxbg==&platform=Desktop&hasNews=1&NewsRange=7&NewsCategory=ALLG&nbResults=500&searchType=Advanced&currentFavoritesListPK=-1&isTypeResultMonographieTitle=1&nbResultToShowTable=100; path=/

set isTypeResultMonographieTitle

        @agent.cookie_jar.each do |cookie|
          if cookie.name =~ /^dm\.kompendium/
            cookie.value.gsub!(/language=EN/, 'language=DE')
            cookie.value.gsub!(/isTypeResultMonographieTitle=0/, 'isTypeResultMonographieTitle=1')
          end 
        end
[18] 1.9.3-p194(#<ODDB::TextInfoPlugin>)> @agent.cookies.last
=> dm.kompendium=langage=EN&contentLangage=DE&GLN=1&Username=Rm9yIG1lZGljYWwgc3RhZmY=&platform=Desktop&hasNews=1&NewsRange=7&NewsCategory=ALLG&nbResults=500&searchType=Advanced&currentFavoritesListPK=-1&isTypeResultMonographieTitle=1&nbResultToShowTable=100
[19] 1.9.3-p194(#<ODDB::TextInfoPlugin>)> @agent.cookies.last.acceptable_from_uri?(URI.parse('http://compendium.ch'))
=> true
[20] 1.9.3-p194(#<ODDB::TextInfoPlugin>)> @agent.cookies.last.expired?
=> false
[21] 1.9.3-p194(#<ODDB::TextInfoPlugin>)> 

But there are still products in search result.

tried
  • imitate request to /options/de
  • make imitate cookie
=> #<Mechanize::Page
 {url
  #<URI::HTTP:0x00000008cfdae8 URL:http://compendium.ch/search/all/Novartis!20Pharma!20Schweiz!20AG/de>}
 {meta_refresh}
 {title "\r\n\tcompendium.ch\r\n"}
 {iframes}
 {frames}
 {links
  #<Mechanize::Page::Link
   "\r\n                    \r\n                        \r\n                "
   "http://www.documed.ch">
  #<Mechanize::Page::Link
   "Home"
   "javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(\"ctl00$ucParentNode$lnkParent\", \"\", false, \"\", \
  #<Mechanize::Page::Link "select" nil>
  #<Mechanize::Page::Link "" "/prod/pnr/1054836/de">
  #<Mechanize::Page::Link
   "ACLASTA Inf Lös 5 mg/100mlZoledronsäure"
   "/prod/pnr/1054836/de">
  #<Mechanize::Page::Link
   "Amp 100 mlNovartis Pharma Schweiz AG"
   "/prod/pnr/1054836/de">
  #<Mechanize::Page::Link
...

use hidden parameters in result list. (It seems that is product's __ID__ in compendium.ch)

    [text:0x4535418 type: text name: ctl00$MainContent$ucProductSearch1$rcbSearch value: Streuli Pharma AG]
    ...
    [hidden:0x45375d8 type: hidden name: ctl00$MainContent$ucProductSearch1$gvwProducts$ctl02$hfKompendiumNR value: 2875]
    [hidden:0x4536ef8 type: hidden name: ctl00$MainContent$ucProductSearch1$gvwProducts$ctl03$hfKompendiumNR value: 2875]
    [hidden:0x453aae4 type: hidden name: ctl00$MainContent$ucProductSearch1$gvwProducts$ctl04$hfKompendiumNR value: 2875]
    [hidden:0x453a60c type: hidden name: ctl00$MainContent$ucProductSearch1$gvwProducts$ctl05$hfKompendiumNR value: 2875]
    [hidden:0x453a080 type: hidden name: ctl00$MainContent$ucProductSearch1$gvwProducts$ctl06$hfKompendiumNR value: 4281]
    [hidden:0x4539e28 type: hidden name: ctl00$MainContent$ucProductSearch1$gvwProducts$ctl07$hfKompendiumNR value: 19391]
    [hidden:0x4539b44 type: hidden name: ctl00$MainContent$ucProductSearch1$gvwProducts$ctl08$hfKompendiumNR value: 19391]
    [hidden:0x45396bc type: hidden name: ctl00$MainContent$ucProductSearch1$gvwProducts$ctl09$hfKompendiumNR value: 15126]
    [hidden:0x4539144 type: hidden name: ctl00$MainContent$ucProductSearch1$gvwProducts$ctl10$hfKompendiumNR value: 15126]
    [hidden:0x453ce20 type: hidden name: ctl00$MainContent$ucProductSearch1$gvwProducts$ctl11$hfKompendiumNR value: 19476]
    [hidden:0x453c81c type: hidden name: ctl00$MainContent$ucProductSearch1$gvwProducts$ctl12$hfKompendiumNR value: 19476]
    [hidden:0x453c268 type: hidden name: ctl00$MainContent$ucProductSearch1$gvwProducts$ctl13$hfKompendiumNR value: 19476]
    [hidden:0x453bd7c type: hidden name: ctl00$MainContent$ucProductSearch1$gvwProducts$ctl14$hfKompendiumNR value: 19476]
    [hidden:0x453b8e0 type: hidden name: ctl00$MainContent$ucProductSearch1$gvwProducts$ctl15$hfKompendiumNR value: 2800]
    [hidden:0x453b138 type: hidden name: ctl00$MainContent$ucProductSearch1$gvwProducts$ctl16$hfKompendiumNR value: 4282]
    ...

option is correct.

[12] 1.9.3-p194(#<ODDB::TextInfoPlugin>)> form.radiobutton_with(:id => 'ctl00_MainContent_rblMonographie_1')
=> [radiobutton:0x592a860 type: radio name: ctl00$MainContent$rblMonographie value: 1]
[13] 1.9.3-p194(#<ODDB::TextInfoPlugin>)> form.radiobutton_with(:id => 'ctl00_MainContent_rblMonographie_1').value
=> "1"
[14] 1.9.3-p194(#<ODDB::TextInfoPlugin>)> form.radiobutton_with(:id => 'ctl00_MainContent_rblMonographie_1').checked?
=> true

but search result does not return "Location" header...

[4] 1.9.3-p194(#<ODDB::TextInfoPlugin>)> res.response
=> {"connection"=>"Keep-Alive",
 "date"=>"Mon, 03 Dec 2012 10:51:07 GMT",
 "content-type"=>"text/html; charset=utf-8",
 "server"=>"Microsoft-IIS/7.0",
 "cache-control"=>"private",
 "x-aspnet-version"=>"2.0.50727",
 "x-ua-compatible"=>"IE=9",
 "transfer-encoding"=>"chunked",
 "content-encoding"=>"gzip",
 "vary"=>"Accept-Encoding"}
view · edit · sidebar · attach · print · history
Page last modified on December 03, 2012, at 11:54 AM