我从webscrape中回来了
\n \n var more_options_on_polling = 0;\n var more_options_polling_delay = 120;\n var more_options_polling_threshold = 90;\n\n var edp = null;\n var media_server = 'http://media.ticketmaster.co.uk/tm/en-gb';\n \n new OnWindowLoad(function(){\n \n var venue_info = new Module( \"venue_info_1\" );\n var seating_chart = new SeatingChartDisplay({default_id: 11522, map_size: [ 469, 287 ], viewport_width: 502}); seating_chart.add_chart( { id: \"11522\", description: unescape(\"Generic\"), small_image: \"http://media.ticketmaster.co.uk/tm/en-gb/tmimages/venue/maps/uk4/11522s_a.gif\", image: \"http://media.ticketmaster.co.uk/tm/en-gb/tmimages/venue/maps/uk4/11522s.gif\", alt: \"Seating Chart\" } ); venue_info.seating_chart = seating_chart;\n seating_chart.setup_display();\n seating_chart.attach( venue_info.$(\"venue_seating_chart\") );\n seating_chart.show(); \n var decline_checkbox = {}; \n if ($('prepare_for_decline_checkbox')) {\n decline_checkbox = new Module ('prepare_for_decline_checkbox');\n }\n \n var merchandise = {};\n var merch_id;\n \n edp = new EDP({\n ism_bba_separation: 0,\n is_bba: 0,\n event: new TMEvent({\"event_id\":\"370050789149169E\",\"date\":\"Mon 4 Jul 2016, 19:30\",\"suppress_best_available\":\"\",\"sorted_ticket_types\":[\"000000000001\",\"000000000005\"],\"is_resale_eligible\":0,\"ada_tickets_enabled\":0,\"suppress_any_price\":\"\",\"expand_resale_module_ntf\":1,\"expand_resale_module\":\"\",\"bba_deep_links_offer_code\":\"Offer Code\",\"tu\":{\"ISM_SEAT_COMPANION\":\"Companion Seat\",\"ISM_SEAT_WHEELCHAIR_ACCESS\":\"Wheelchair Accessible Seat\",\"ISM_SEAT_SIGHT_HEARING\":\"Blind/Partially sighted/Deaf/Hard of hearing\",\"EVENT_QUANTITY_LIMIT_EXACT\":\"Must buy\",\"EVENT_QUANTITY_LIMIT_MULTIPLE\":\"Multiples of\",\"BBA_PRICES_ARE_IN\":\"Prices are in\",\"BA_SEAT_SEATS\":\"Seats\",\"ISM_SEAT_MOBILITY_IMPAIRED\":\"Mobility Impaired\",\"BA_SEAT_EA\":\"ea\",\"BA_SEAT_SEC\":\"Sec\",\"EVENT_QUANTITY_LIMIT_MAX\":\"Max\",\"BA_SEAT_ROW\":\"Row\",\"EVENT_QUANTITY_LIMIT_MIN\":\"Min\"},\"url\":\"http://www.ticketmaster.co.uk/event/370050789149169E\",\"enable_fee_rollup\":1,\"addna\":[{\"name\":\"GRAND\",\"description\":\"Grand Circle\"},{\"name\":\"STALLS\",\"description\":\"Stalls\"},{\"name\":\"UPPER\",\"description\":\"Upper Circle\"}],\"bba_deep_links\":1,\"list_price_prominence\":0,\"location\":\"Glasgow, <abbr title=\\\"\\\"></abbr>\",\"view_from_section_timeout\":\"\",\"avs_conf\":{\"edp_avs\":{\"enabled\":1},\"availability_url\":\"/app/availability/370050789149169E\",\"busy_refresh_freq\":5,\"auto_refresh_freq\":44,\"browser_idle_time\":300},\"name\":\"Derren Brown: Miracle\",\"v\":\"fCOlx42xVvEAezQz83qoDd1k1BTRk1pVMv2HRDlSuraUoYurjO3Z1cMX1m3BQhNF3H4WFQ\",\"uk_fee_disclaimer\":1,\"full_secnames\":{\"PSTALL\":\"Premium Stalls\",\"GALLERY\":\"Gallery\",\"P2\":\"Price Level 2\",\"GRAND\":\"Grand Circle\",\"P1\":\"Price Level 1\",\"STALLS\":\"Stalls\",\"SNDG\":\"Incl. 1.25 Restoration Levy\",\"P3\":\"Premium Price Level\",\"UPPER\":\"Upper Circle\"},\"resale_max_display_tickets\":500,\"isc_enabled\":0,\"is_presale_eligible\":0,\"secnames\":{\"PSTALL\":{\"price_levels\":[\"3\"],\"group\":\"2\",\"masks\":{\"4\":0,\"1\":4,\"3\":0,\"2\":4},\"v\":\"DL0CAYZ09gWnqEhvbomtkVHHnoIOsngskZ8NCJnR_KZUzJL6sRwqyk_p\",\"secname\":\"PSTALL\",\"description\":\"Premium Stalls\"},\"P2\":{\"price_levels\":null,\"group\":\"1\",\"masks\":{\"4\":0,\"1\":2,\"3\":0,\"2\":1},\"v\":\"ohi_LqhH65JNTJ2BKWWCW750ppbYgZ8BAK9z5QpabOw-z-ggyaM\",\"secname\":\"P2\",\"description\":\"Price Level 2\"},\"GALLERY\":{\"price_levels\":[\"1\",\"2\"],\"group\":\"2\",\"masks\":{\"4\":0,\"1\":3,\"3\":0,\"2\":1},\"v\":\"Q1zXCx6Iko3RV-4JTu6BHccAhdJg7_vy__L470_-3eQ0vbNmtSi3LkYeUg\",\"secname\":\"GALLERY\",\"description\":\"Gallery\"},\"GRAND\":{\"price_levels\":[\"1\"],\"group\":\"2\",\"masks\":{\"4\":0,\"1\":1,\"3\":0,\"2\":2},\"v\":\"XA0YOWmmENqfuYgqUnbVbo0e6Ac1dghFrOqfS_ioo-dcl3focmPNYMI\",\"secname\":\"GRAND\",\"description\":\"Grand Circle\"},\"P1\":{\"price_levels\":null,\"group\":\"1\",\"masks\":{\"4\":0,\"1\":1,\"3\":0,\"2\":27},\"v\":\"0wNxYqt2gaq7hCCYgMyKnropWd2xHBQKKi6hnLyLJPFDpZ5ClAc\",\"secname\":\"P1\",\"description\":\"Price Level 1\"},\"STALLS\":{\"price_levels\":[\"1\"],\"group\":\"2\",\"masks\":{\"4\":0,\"1\":1,\"3\":0,\"2\":8},\"v\":\"E1cggjdGj3SYNr3RLKubO_usMe6NfX6gqAtvFZ1RkkLaSoNlc89GsJKq\",\"secname\":\"STALLS\",\"description\":\"Stalls\"},\"P3\":{\"price_levels\":null,\"group\":\"1\",\"masks\":{\"4\":0,\"1\":4,\"3\":0,\"2\":4},\"v\":\"1nvK9ZI-adldztFha_gdIiguSFQGTguSZVFb2gEiNr1Jk5ZryIE\",\"secname\":\"P3\",\"description\":\"Premium Price Level\"},\"UPPER\":{\"price_levels\":[\"1\"],\"group\":\"2\",\"masks\":{\"4\":0,\"1\":1,\"3\":0,\"2\":16},\"v\":\"BRlBwOGr_ZUuM-Y19hfPVVbrIWawNvz3XDn-qWHpkfZOHUZ892qVJWg\",\"secname\":\"UPPER\",\"description\":\"Upper Circle\"}},\"ga_event\":\"\",\"secnames2tickettypes\":{\"PSTALL\":[{\"price_secname\":\"P3\",\"price_breakdown\":{\"taxes\":{\"vat\":0,\"svc_tax\":0,\"svc_tax2\":0},\"price_secname\":\"P3\",\"vat\":0,\"distance_charge\":0,\"display_charges\":{\"formatted_sum_fees\":\"£5.60\",\"total_price\":\"52.1\",\"formatted_price\":\"£46.50\",\"has_taxes\":0,\"has_ppf\":null,\"has_fees\":1,\"sum_taxes\":0,\"sum_fees_and_taxes\":\"5.6\",\"price\":\"46.5\",\"formatted_sum_fees_and_taxes\":\"£5.60\",\"sum_fees\":\"5.6\",\"formatted_total_price\":\"£52.10\"},\"svc_tax2\":0,\"price_level\":3,\"facility_charge\":0,\"service_charge\":\"5.6\",\"face_value\":\"46.5\",\"svc_tax\":0,\"legacy_price\":\"46.5\"},\"qmask_level\":0,\"secname_id\":\"4\",\"description\":\"Premium Stalls\",\"ticket_desc\":\"Premium Seating Ticket\",\"price_secname_id\":2,\"secname_group_id\":\"2\",\"price\":\"46.5\",\"ticket_type\":\"L\",\"secname\":\"PSTALL\",\"ext_ticket_type\":\"000000000005\"}],\"GALLERY\":[{\"price_secname\":\"P1\",\"price_breakdown\":{\"taxes\":{\"vat\":0,\"svc_tax\":0,\"svc_tax2\":0},\"price_secname\":\"P1\",\"vat\":0,\"distance_charge\":0,\"display_charges\":{\"formatted_sum_fees\":\"£4.50\",\"total_price\":42,\"formatted_price\":\"£37.50\",\"has_taxes\":0,\"has_ppf\":null,\"has_fees\":1,\"sum_taxes\":0,\"sum_fees_and_taxes\":\"4.5\",\"price\":\"37.5\",\"formatted_sum_fees_and_taxes\":\"£4.50\",\"sum_fees\":\"4.5\",\"formatted_total_price\":\"£42.00\"},\"svc_tax2\":0,\"price_level\":1,\"facility_charge\":0,\"service_charge\":\"4.5\",\"face_value\":\"37.5\",\"svc_tax\":0,\"legacy_price\":\"37.5\"},\"qmask_level\":0,\"secname_id\":\"9\",\"description\":\"Gallery\",\"ticket_desc\":\"Full Price Ticket\",\"price_secname_id\":0,\"secname_group_id\":\"2\",\"price\":\"37.5\",\"ticket_type\":\"A\",\"secname\":\"GALLERY\",\"ext_ticket_type\":\"000000000001\"},{\"price_secname\":\"P2\",\"price_breakdown\":{\"taxes\":{\"vat\":0,\"svc_tax\":0,\"svc_tax2\":0},\"price_secname\":\"P2\",\"vat\":0,\"distance_charge\":0,\"display_charges\":{\"formatted_sum_fees\":\"£3.30\",\"total_price\":\"30.8\",\"formatted_price\":\"£27.50\",\"has_taxes\":0,\"has_ppf\":null,\"has_fees\":1,\"sum_taxes\":0,\"sum_fees_and_taxes\":\"3.3\",\"price\":\"27.5\",\"formatted_sum_fees_and_taxes\":\"£3.30\",\"sum_fees\":\"3.3\",\"formatted_total_price\":\"£30.80\"},\"svc_tax2\":0,\"price_level\":2,\"facility_charge\":0,\"service_charge\":\"3.3\",\"face_value\":\"27.5\",\"svc_tax\":0,\"legacy_price\":\"27.5\"},\"qmask_level\":0,\"secname_id\":9,\"description\":\"Gallery\",\"ticket_desc\":\"Full Price Ticket\",\"price_secname_id\":1,\"secname_group_id\":2,\"price\":\"27.5\",\"ticket_type\":\"A\",\"secname\":\"GALLERY\",\"ext_ticket_type\":\"000000000001\"}],\"P2\":[{\"price_secname\":\"P2\",\"price_breakdown\":{\"taxes\":{\"vat\":0,\"svc_tax\":0,\"svc_tax2\":0},\"price_secname\":\"P2\",\"vat\":0,\"distance_charge\":0,\"display_charges\":{\"formatted_sum_fees\":\"£3.30\",\"total_price\":\"30.8\",\"formatted_price\":\"£27.50\",\"has_taxes\":0,\"has_ppf\":null,\"has_fees\":1,\"sum_taxes\":0,\"sum_fees_and_taxes\":\"3.3\",\"price\":\"27.5\",\"formatted_sum_fees_and_taxes\":\"£3.30\",\"sum_fees\":\"3.3\",\"formatted_total_price\":\"£30.80\"},\"svc_tax2\":0,\"price_level\":2,\"facility_charge\":0,\"service_charge\":\"3.3\",\"face_value\":\"27.5\",\"svc_tax\":0,\"legacy_price\":\"27.5\"},\"qmask_level\":0,\"secname_id\":\"1\",\"description\":\"Price Level 2\",\"ticket_desc\":\"Full Price Ticket\",\"price_secname_id\":1,\"secname_group_id\":\"1\",\"price\":\"27.5\",\"ticket_type\":\"A\",\"secname\":\"P2\",\"ext_ticket_type\":\"000000000001\"}],\"GRAND\":[{\"price_secname\":\"P1\",\"price_breakdown\":{\"taxes\":{\"vat\":0,\"svc_tax\":0,\"svc_tax2\":0},\"price_secname\":\"P1\",\"vat\":0,\"distance_charge\":0,\"display_charges\":{\"formatted_sum_fees\":\"£4.50\",\"total_price\":42,\"formatted_price\":\"£37.50\",\"has_taxes\":0,\"has_ppf\":null,\"has_fees\":1,\"sum_taxes\":0,\"sum_fees_and_taxes\":\"4.5\",\"price\":\"37.5\",\"formatted_sum_fees_and_taxes\":\"£4.50\",\"sum_fees\":\"4.5\",\"formatted_total_price\":\"£42.00\"},\"svc_tax2\":0,\"price_level\":1,\"facility_charge\":0,\"service_charge\":\"4.5\",\"face_value\":\"37.5\",\"svc_tax\":0,\"legacy_price\":\"37.5\"},\"qmask_level\":0,\"secname_id\":\"7\",\"description\":\"Grand Circle\",\"ticket_desc\":\"Full Price Ticket\",\"price_secname_id\":0,\"secname_group_id\":\"2\",\"price\":\"37.5\",\"ticket_type\":\"A\",\"secname\":\"GRAND\",\"ext_ticket_type\":\"000000000001\"}],\"P1\":[{\"price_secname\":\"P1\",\"price_breakdown\":{\"taxes\":{\"vat\":0,\"svc_tax\":0,\"svc_tax2\":0},\"price_secname\":\"P1\",\"vat\":0,\"distance_charge\":0,\"display_charges\":{\"formatted_sum_fees\":\"£4.50\",\"total_price\":42,\"formatted_price\":\"£37.50\",\"has_taxes\":0,\"has_ppf\":null,\"has_fees\":1,\"sum_taxes\":0,\"sum_fees_and_taxes\":\"4.5\",\"price\":\"37.5\",\"formatted_sum_fees_and_taxes\":\"£4.50\",\"sum_fees\":\"4.5\",\"formatted_total_price\":\"£42.00\"},\"svc_tax2\":0,\"price_level\":1,\"facility_charge\":0,\"service_charge\":\"4.5\",\"face_value\":\"37.5\",\"svc_tax\":0,\"legacy_price\":\"37.5\"},\"qmask_level\":0,\"secname_id\":\"0\",\"description\":\"Price Level 1\",\"ticket_desc\":\"Full Price Ticket\",\"price_secname_id\":0,\"secname_group_id\":\"1\",\"price\":\"37.5\",\"ticket_type\":\"A\",\"secname\":\"P1\",\"ext_ticket_type\":\"000000000001\"}],\"STALLS\":[{\"price_secname\":\"P1\",\"price_breakdown\":{\"taxes\":{\"vat\":0,\"svc_tax\":0,\"svc_tax2\":0},\"price_secname\":\"P1\",\"vat\":0,\"distance_charge\":0,\"display_charges\":{\"formatted_sum_fees\":\"£4.50\",\"total_price\":42,\"formatted_price\":\"£37.50\",\"has_taxes\":0,\"has_ppf\":null,\"has_fees\":1,\"sum_taxes\":0,\"sum_fees_and_taxes\":\"4.5\",\"price\":\"37.5\",\"formatted_sum_fees_and_taxes\":\"£4.50\",\"sum_fees\":\"4.5\",\"formatted_total_price\":\"£42.00\"},\"svc_tax2\":0,\"price_level\":1,\"facility_charge\":0,\"service_charge\":\"4.5\",\"face_value\":\"37.5\",\"svc_tax\":0,\"legacy_price\":\"37.5\"},\"qmask_level\":0,\"secname_id\":\"5\",\"description\":\"Stalls\",\"ticket_desc\":\"Full Price Ticket\",\"price_secname_id\":0,\"secname_group_id\":\"2\",\"price\":\"37.5\",\"ticket_type\":\"A\",\"secname\":\"STALLS\",\"ext_ticket_type\":\"000000000001\"}],\"P3\":[{\"price_secname\":\"P3\",\"price_breakdown\":{\"taxes\":{\"vat\":0,\"svc_tax\":0,\"svc_tax2\":0},\"price_secname\":\"P3\",\"vat\":0,\"distance_charge\":0,\"display_charges\":{\"formatted_sum_fees\":\"£5.60\",\"total_price\":\"52.1\",\"formatted_price\":\"£46.50\",\"has_taxes\":0,\"has_ppf\":null,\"has_fees\":1,\"sum_taxes\":0,\"sum_fees_and_taxes\":\"5.6\",\"price\":\"46.5\",\"formatted_sum_fees_and_taxes\":\"£5.60\",\"sum_fees\":\"5.6\",\"formatted_total_price\":\"£52.10\"},\"svc_tax2\":0,\"price_level\":3,\"facility_charge\":0,\"service_charge\":\"5.6\",\"face_value\":\"46.5\",\"svc_tax\":0,\"legacy_price\":\"46.5\"},\"qmask_level\":0,\"secname_id\":\"2\",\"description\":\"Premium Price Level\",\"ticket_desc\":\"Premium Seating Ticket\",\"price_secname_id\":2,\"secname_group_id\":\"1\",\"price\":\"46.5\",\"ticket_type\":\"L\",\"secname\":\"P3\",\"ext_ticket_type\":\"000000000005\"}],\"UPPER\":[{\"price_secname\":\"P1\",\"price_breakdown\":{\"taxes\":{\"vat\":0,\"svc_tax\":0,\"svc_tax2\":0},\"price_secname\":\"P1\",\"vat\":0,\"distance_charge\":0,\"display_charges\":{\"formatted_sum_fees\":\"£4.50\",\"total_price\":42,\"formatted_price\":\"£37.50\",\"has_taxes\":0,\"has_ppf\":null,\"has_fees\":1,\"sum_taxes\":0,\"sum_fees_and_taxes\":\"4.5\",\"price\":\"37.5\",\"formatted_sum_fees_and_taxes\":\"£4.50\",\"sum_fees\":\"4.5\",\"formatted_total_price\":\"£42.00\"},\"svc_tax2\":0,\"price_level\":1,\"facility_charge\":0,\"service_charge\":\"4.5\",\"face_value\":\"37.5\",\"svc_tax\":0,\"legacy_price\":\"37.5\"},\"qmask_level\":0,\"secname_id\":\"8\",\"description\":\"Upper Circle\",\"ticket_desc\":\"Full Price Ticket\",\"price_secname_id\":0,\"secname_group_id\":\"2\",\"price\":\"37.5\",\"ticket_type\":\"A\",\"secname\":\"UPPER\",\"ext_ticket_type\":\"000000000001\"}]},\"isc_disabled_reason\":\"no-venue-config\",\"ticket_type_map\":{\"000000000005\":{\"discount_number\":\"0\",\"rep_name\":\"\",\"price_breakdown\":{\"3\":{\"taxes\":{\"vat\":0,\"svc_tax\":0,\"svc_tax2\":0},\"price_secname\":\"P3\",\"vat\":0,\"distance_charge\":0,\"display_charges\":{\"formatted_sum_fees\":\"£5.60\",\"total_price\":\"52.1\",\"formatted_price\":\"£46.50\",\"has_taxes\":0,\"has_ppf\":null,\"has_fees\":1,\"sum_taxes\":0,\"sum_fees_and_taxes\":\"5.6\",\"price\":\"46.5\",\"formatted_sum_fees_and_taxes\":\"£5.60\",\"sum_fees\":\"5.6\",\"formatted_total_price\":\"£52.10\"},\"svc_tax2\":0,\"price_level\":3,\"facility_charge\":0,\"service_charge\":\"5.6\",\"face_value\":\"46.5\",\"svc_tax\":0,\"legacy_price\":\"46.5\"}},\"discrete\":{\"public\":\"Y\",\"codes\":[]},\"quantity_limits\":{\"inc\":1,\"min\":0,\"max\":\"9\"},\"repname_quantity_limits\":{},\"qmask_level\":\"0\",\"variable_qualifier_value\":0,\"ada_qualifier_value\":0,\"v\":\"6HYc2evAUFOVaRUgmHpxRrW2Xzi9AEbh7Z8OADWvMPkfCvclBbOvXR334UND1BYrh_Xsbiw-BmAahlFrTVf-LeA\",\"description\":\"Premium Seating Ticket\",\"price_level_preferred\":0,\"unsold_qualifier_value\":0,\"ext_ticket_type\":\"000000000005\",\"display_priority\":0},\"000000000001\":{\"discount_number\":\"0\",\"rep_name\":\"\",\"price_breakdown\":{\"1\":{\"taxes\":{\"vat\":0,\"svc_tax\":0,\"svc_tax2\":0},\"price_secname\":\"P1\",\"vat\":0,\"distance_charge\":0,\"display_charges\":{\"formatted_sum_fees\":\"£4.50\",\"total_price\":42,\"formatted_price\":\"£37.50\",\"has_taxes\":0,\"has_ppf\":null,\"has_fees\":1,\"sum_taxes\":0,\"sum_fees_and_taxes\":\"4.5\",\"price\":\"37.5\",\"formatted_sum_fees_and_taxes\":\"£4.50\",\"sum_fees\":\"4.5\",\"formatted_total_price\":\"£42.00\"},\"svc_tax2\":0,\"price_level\":1,\"facility_charge\":0,\"service_charge\":\"4.5\",\"face_value\":\"37.5\",\"svc_tax\":0,\"legacy_price\":\"37.5\"},\"2\":{\"taxes\":{\"vat\":0,\"svc_tax\":0,\"svc_tax2\":0},\"price_secname\":\"P2\",\"vat\":0,\"distance_charge\":0,\"display_charges\":{\"formatted_sum_fees\":\"£3.30\",\"total_price\":\"30.8\",\"formatted_price\":\"£27.50\",\"has_taxes\":0,\"has_ppf\":null,\"has_fees\":1,\"sum_taxes\":0,\"sum_fees_and_taxes\":\"3.3\",\"price\":\"27.5\",\"formatted_sum_fees_and_taxes\":\"£3.30\",\"sum_fees\":\"3.3\",\"formatted_total_price\":\"£30.80\"},\"svc_tax2\":0,\"price_level\":2,\"facility_charge\":0,\"service_charge\":\"3.3\",\"face_value\":\"27.5\",\"svc_tax\":0,\"legacy_price\":\"27.5\"}},\"discrete\":{\"public\":\"Y\",\"codes\":[]},\"quantity_limits\":{\"inc\":1,\"min\":0,\"max\":\"9\"},\"repname_quantity_limits\":{},\"qmask_level\":\"0\",\"variable_qualifier_value\":0,\"ada_qualifier_value\":0,\"v\":\"83PseEIxNmK8f7G1LuoUZxz_PeXzj9rAIt7NkS6N9OMQoS0xn58jFDI7lUDFvHW5soLAr-EBXiFbpsHWkuneh_8\",\"description\":\"Full Price Ticket\",\"price_level_preferred\":0,\"unsold_qualifier_value\":0,\"ext_ticket_type\":\"000000000001\",\"display_priority\":0}},\"enable_fru_equations\":0,\"price_limit\":0,\"ada_types\":{},\"currency_symbol\":\"£\",\"price_level_aliases\":{},\"platinum_postings\":0,\"tmPlus_enabledMessaging\":0,\"display_type\":\"standard\",\"timed_entry\":0,\"inline_fee_rollup\":0,\"venue\":\"Kings Theatre Glasgow\",\"ticket_limit\":\"9\",\"artist_image\":\"http://media.ticketmaster.co.uk/tm/en-gb/dbimages/57600a.jpg\",\"ready_to_expand\":0,\"isc_can_enable\":\"\",\"ada_ticket_limit\":\"0\",\"date_without_abbr\":\"Mon 4 Jul 2016, 19:30\"}),\n venue_info: venue_info,\n merchandise: merchandise,\n decline_checkbox: decline_checkbox ,mycart: true\n ,cart_request_server: \"https://www.ticketmaster.co.uk\" });\n window.monetateQ.push([\"setPageType\", \"product\"]);\n window.monetateQ.push([\"addProductDetails\", edp.event.event_id]); });\n
我理想的是要显示代码中的formatted_sum_fees
和formatted_price
。 (此刻我将此作为我的佣金任务中的变量显示)
感谢您的帮助!
萨姆
修改
所以我有什么
namespace :task do
task test: :environment do
ticketmaster_url = "http://www.ticketmaster.co.uk/derren-brown-miracle-glasgow-04-07-2016/event/370050789149169E?artistid=1408737&majorcatid=10002&minorcatid=53&tpab=-1"
doc = Nokogiri::HTML(open(ticketmaster_url))
event_name = nil
ticket_price = nil
doc.xpath("//script[@type='text/javascript']/text()").each do |text|
if text.content =~ /more_options_on_polling/
ticket_price = text.scan(/\"(formatted_(?:price|sum_fees))\":\"(.+?)\"/)
end
end
puts "Event name: " + event_name
puts "Ticket price: " + ticket_price.to_s
end
end
我得到了这个错误
NoMethodError:#
的未定义方法`scan'第二次修改 所以我现在就回来了。
[["formatted_sum_fees", "£5.60"], ["formatted_price", "£46.50"], ["formatted_sum_fees", "£4.50"], ["formatted_price", "£37.50"], ["formatted_sum_fees", "£3.30"], ["formatted_price", "£27.50"], ["formatted_sum_fees", "£3.30"], ["formatted_price", "£27.50"], ["formatted_sum_fees", "£4.50"], ["formatted_price", "£37.50"], ["formatted_sum_fees", "£4.50"], ["formatted_price", "£37.50"], ["formatted_sum_fees", "£4.50"], ["formatted_price", "£37.50"], ["formatted_sum_fees", "£5.60"], ["formatted_price", "£46.50"], ["formatted_sum_fees", "£4.50"], ["formatted_price", "£37.50"], ["formatted_sum_fees", "£5.60"], ["formatted_price", "£46.50"], ["formatted_sum_fees", "£4.50"], ["formatted_price", "£37.50"], ["formatted_sum_fees", "£3.30"], ["formatted_price", "£27.50"]]
我现在怎样才能使用它?
答案 0 :(得分:1)
要通过正则表达式提取值,您可以使用String#scan()
。
我们假设您在str
上有长字符串,代码将是
str.scan(/\"(formatted_(?:price|sum_fees))\":\"(.+?)\"/)