Local Trends (GET trends/:woeid) not returning any data

ibias
@ibias Luciano

I can't get any data using the query
http://api.twitter.com/1/trends/:woeid.format
(from this page: https://dev.twitter.com/docs/api/1/get/trends/%3Awoeid)

When I check what trends you guys have available using
http://api.twitter.com/1/trends/available.xml
I can see a lot of cities are available. Tampa, for example.

If I try to query for Tampa using
http://api.twitter.com/1/trends/:2503863.xml
I get a response like:
"No data for WOEID"

Actually, I get always "no data". No matter what WOEid I use.

1 year 4 days ago

Replies

episod
@episod Taylor Singletary

Hi @ibias,

You've got an extra colon in your URL there (the ":" in our documentation is a sign that field is inline token in the path).

https://api.twitter.com/1/trends/2503863.xml is the URL you want, and it returns something like this right now:

  1. <matching_trends type="array">
  2. <trends as_of="2011-08-04T15:43:18Z" created_at="2011-08-04T15:42:01Z">
  3. <locations>
  4. <location>
  5. <woeid>2503863</woeid>
  6. <name>Tampa</name>
  7. </location>
  8. </locations>
  9. <trend query="%23ideservehead" url="http://search.twitter.com/search?q=%23ideservehead">#ideservehead</trend>
  10. <trend query="%23saveit" url="http://search.twitter.com/search?q=%23saveit">#saveit</trend>
  11. <trend query="%23getsonmynerves" url="http://search.twitter.com/search?q=%23getsonmynerves">#getsonmynerves</trend>
  12. <trend query="Pottermore" url="http://search.twitter.com/search?q=Pottermore">Pottermore</trend>
  13. <trend query="%22Tropical%20Storm%20Emily%22" url="http://search.twitter.com/search?q=%22Tropical%20Storm%20Emily%22">Tropical Storm Emily</trend>
  14. <trend query="FAA" url="http://search.twitter.com/search?q=FAA">FAA</trend>
  15. <trend query="Imax" url="http://search.twitter.com/search?q=Imax">Imax</trend>
  16. <trend query="Weezy" url="http://search.twitter.com/search?q=Weezy">Weezy</trend>
  17. <trend query="%23undateable" url="http://search.twitter.com/search?q=%23undateable">#undateable</trend>
  18. <trend query="%23jerseyshore" url="http://search.twitter.com/search?q=%23jerseyshore">#jerseyshore</trend>
  19. </trends>
  20. </matching_trends>
1 year 4 days ago
ChossiDanser575
@ChossiDanser575 Chossi Danser

xml does not work why?

45 weeks 7 hours ago
richardhyland
@richardhyland Richard Hyland

See https://dev.twitter.com/discussions/835

Twitter have removed support for the XML endpoint.

I'm annoyed by this as when I read the announcement I thought I was fine because I switched to WOEID trends a long time ago.

I missed the bit about XML being removed too and now have 3 broken apps with many thousands of users until Apple approve the update at least 1 week wait.

I don't understand why the need to remove XML endpoints (surely the code is reusable enough to output in multiple formats?)

45 weeks 6 hours ago
ChossiDanser575
@ChossiDanser575 Chossi Danser

is possible to consult with .php that I want to move the channels TT to a .txt

  1.   <head>
  2.   </head>
  3.   <body>
  4.     <div id="trends">
  5.     </div>
  6.     <script>
  7.       function onTrendData(data) {
  8.         var parent = document.getElementById("trends");
  9.         for (var loc = 0; loc < data.length; loc++) {
  10.           for (var i = 0; i < data[loc]["trends"].length; i++) {
  11.             var trend = document.createElement("div");
  12.             var anchor = document.createElement("a");
  13.             parent.appendChild(trend);
  14.             trend.appendChild(anchor);
  15.             anchor.textContent = data[loc]["trends"][i]["name"];
  16.           }
  17.         }
  18.       }
  19.     </script>
  20.     <!-- Change 1.json to the appropriate locale code, as described
  21.          https://dev.twitter.com/docs/api/1/get/trends/%3Awoeid -->
  22.     <script src="https://api.twitter.com/1/trends/1.json?callback=onTrendData"></script>
  23.   </body>

<?php
{
$desc = fopen("trends.htm", "r");
$escr = fopen("fichero.txt", "w") or die ("no se puede crear!!!");
while (!feof($desc))
{
$linea = fgetss($desc, 256, "");
echo $linea;
fputs ($escr, trim($linea)." ");
}
fclose($escr);
fclose($desc);
}
?>

myself clear?
I copy this happens to txt

function onTrendData(data) { var parent = document.getElementById("trends"); for (var loc = 0; loc < data.length; loc++) { for (var i = 0; i < data[loc]["trends"].length; i++) { var trend = document.createElement("div"); var anchor = document.createElement("a"); parent.appendChild(trend); trend.appendChild(anchor); anchor.textContent = data[loc]["trends"][i]["name"]; } } }

45 weeks 2 hours ago
ChossiDanser575
@ChossiDanser575 Chossi Danser

no way to make an appointment with php

45 weeks 2 hours ago
ChossiDanser575
@ChossiDanser575 Chossi Danser

-

45 weeks 5 min ago
ibias
@ibias Luciano

:-P
Tks.

1 year 4 days ago
ChossiDanser575
@ChossiDanser575 Chossi Danser

xml does not work why?

45 weeks 7 hours ago
richardhyland
@richardhyland Richard Hyland

See https://dev.twitter.com/discussions/835

Twitter have removed support for the XML endpoint.

I'm annoyed by this as when I read the announcement I thought I was fine because I switched to WOEID trends a long time ago.

I missed the bit about XML being removed too and now have 3 broken apps with many thousands of users until Apple approve the update at least 1 week wait.

I don't understand why the need to remove XML endpoints (surely the code is reusable enough to output in multiple formats?)

45 weeks 6 hours ago
episod
@episod Taylor Singletary

Sorry that you did not notice that part of the announcement, Richard.

We've been favoring JSON formats for all of our APIs for some time now -- supporting multiple formats can be a burden in a few different ways, especially for the Trends API. XML usage was comparatively minuscule to JSON usage and we got little to no complaints when we announced it in August.

45 weeks 5 hours ago
pjakhar28
@pjakhar28 Preeti jakhar

sir i want to make a program which can drag the twitter trends but it show only countries not there trends my progrem coding is here: plz check it and tell me my mistake

  1. <head>
  2.  <script type="text/javascript">
  3.  function showTrend(str)
  4.  {
  5.  
  6. var str=document.getElementById("");
  7.  var xmlhttp; //create object
  8.  if (str=="")
  9.    {
  10.    document.getElementById("txtHint").innerHTML="";
  11.    return;
  12.    }
  13. if (window.XMLHttpRequest)
  14.    {  // code for IE7+, Firefox, Chrome, Opera, Safari
  15.    xmlhttp=new XMLHttpRequest();
  16.    }
  17.  else
  18.    {  // code for IE6, IE5
  19.    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  20.    }
  21.  
  22.  
  23. xmlhttp.onreadystatechange=function() //ready on state
  24.    {
  25.  
  26.    if (xmlhttp.readyState==4 && xmlhttp.status==200)
  27.      {
  28.      document.getElementById("txtHint").innerHTML=xmlhttp.responseText; //response from server
  29.      }
  30.    }
  31.  xmlhttp.open("GET","https://api.twitter.com/1/trends/"+str+".json",true); //request send to server
  32.  xmlhttp.send();
  33.  }
  34.  
  35.  
  36.  </script>
  37.  </head>
  38. <body>
  39.  
  40.  
  41.  
  42. <form action="" size="6">
  43. <select name="country" onchange="showTrend(this.value)">
  44. <option value="">Select a country:</option>
  45. <option value="23424975">United Kingdom</option><br />
  46.  
  47. <option value="1118129">Japan</option><br />
  48.  
  49.  
  50. <option value="2295420">India</option><br />
  51.  
  52. </select>
  53.  
  54. </form>
  55. <br />
  56. <div id="txtHint">Country trends will be listed here...</div>
  57. <div id="myDiv"><h2>trends</h2></div>
  58.  
  59. </select>
  60.  
  61.  
  62. </body>
7 hours 50 min ago