• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

Getting Socket timeout when trying to get a json from api

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hallo there,

I am trying to get a json file as a response to a url call and I get this error.

The url is following:

https://dsob.opap.gr/sb/sport/soccer/coupon?locale=el&onlyLive=false&marketIds=1&fromDate=2023-08-15&toDate=2023-08-15

What I see, is that the data are perfect loaded when trying from their page

https://pamestoixima.opap.gr/



Am I missing something?

 
Bartender
Posts: 15743
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please show us how you initialize the url variable.
 
Sot Nikele
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:Please show us how you initialize the url variable.



I don't get any errors other than Socket timeout.

The url that i am using is

https://dsob.opap.gr/sb/sport/soccer/coupon?locale=el&onlyLive=false&marketIds=1%2C2%2C31%2C21%2C18%2C18%2C18%2C14&fromDate=2023-08-15&toDate=2023-08-15

where 1%2C2%2C31%2C21%2C18%2C18%2C18%2C14 are the markets shown in the page.

Question: Can a page somehow protect its data and forbid other applications except browsers, to make calls on its api?
 
Sheriff
Posts: 28536
114
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sot Nikele wrote:Question: Can a page somehow protect its data and forbid other applications except browsers, to make calls on its api?

Yes, they absolutely can do that. And football betting sites will be very diligent about blocking access by people who haven't logged in.
 
Sot Nikele
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:

Sot Nikele wrote:Question: Can a page somehow protect its data and forbid other applications except browsers, to make calls on its api?

Yes, they absolutely can do that. And football betting sites will be very diligent about blocking access by people who haven't logged in.



So they can bypass the header that I am adding about the User Agent at the Response object also?
 
Paul Clapham
Sheriff
Posts: 28536
114
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sot Nikele wrote:So they can bypass the header that I am adding about the User Agent at the Response object also?


Apparently so.
 
Marshal
Posts: 4953
625
VSCode Eclipse IDE Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know what the site policy is for scraping information, but you can make this work by adding an Accept header specifying the type of content you are wanting.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic