Reputation: 161
I am trying to get a list of shows using TVRage - An example provided uses this:
Show show = new Show(showName);
XElement xml = XDocument.Load("http://www.tvrage.com/feeds/episode_list.php?show=" + showName).Element("Show");
The error is:
"'text' is an unexpected token. The expected token is '\"' or '''
I cannot find any info
Upvotes: 1
Views: 1814
Reputation: 508
According to your variable it looks like you are expecting a ShowName. If you are only given a show name then you need to retrieve a list of shows that match the name given:
XElement xml = XDocument.Load("http://services.tvrage.com/feeds/search.php?show=" + showName).Element("Show");
This will return all Shows that match the Search Criteria. It might include shows you don't want.
From there you can retrieve the ShowID of the show you want within the XML Results and use dasblinkenlight's answer to retrieve list of episodes for that particular show Id.
For API reference purposes: http://services.tvrage.com/info.php?page=main
Upvotes: 1
Reputation: 726479
This is because your search returned an error, for two reasons:
www
, you must pass services
episode_list
API does not take show name, it takes show ID.Try this:
XElement xml = XDocument.Load("http://services.tvrage.com/feeds/episode_list.php?sid=" + showId).Element("Show");
In order to find show ID by show name, execute a search by querying this URL:
"http://services.tvrage.com/feeds/search.php?show=" + showName
The results would look like this:
<Results>
<show>
<showid>6190</showid> <!-- <<<<<<< Grab this number -->
...
</show>
</Results>
Plug in showId
that you get from the search into the URL above to get a list of episodes.
Upvotes: 2