fork(1) download
  1. require 'uri'
  2. require 'cgi'
  3.  
  4. s1 = 'https://w...content-available-to-author-only...t.com/common/inc/productDetail_price.jsp?skuId=2260697&productId=xlsImpprod4130103'
  5. puts s1
  6. uri_1 = URI.parse(s1)
  7. if uri_1.path.split('/').last != 'productDetail_price.jsp'
  8. puts CGI::parse(uri_1.query)["productId"]
  9. end
  10.  
  11. s2 = 'https://w...content-available-to-author-only...t.com/milk?productId=xlsImpprod18451151'
  12. puts s2
  13. uri_2 = URI.parse(s2)
  14. if uri_2.path.split('/').last != 'productDetail_price.jsp'
  15. puts CGI::parse(uri_2.query)["productId"]
  16. end
  17.  
Success #stdin #stdout 0.04s 7740KB
stdin
Standard input is empty
stdout
https://w...content-available-to-author-only...t.com/common/inc/productDetail_price.jsp?skuId=2260697&productId=xlsImpprod4130103
https://w...content-available-to-author-only...t.com/milk?productId=xlsImpprod18451151
xlsImpprod18451151