Skip to main content

Parse Stack Exchange RSS Feeds Easy Guide!

This tutorial demonstrates how you can Parse Stack Exchange RSS Feeds.

This Google Script will fetch and Parse Stack Exchange RSS Feeds. The content of the RSS feed can then be routinely and automatically pushed to a different email address using the MailApp service. Or you could use Google Scripts to create an RSS to email service. You can use the below mentioned code to Parse Stack Exchange RSS Feeds:

function parseXML() {
  var feed = 'http://stackexchange.com/feeds';

  var xml = UrlFetchApp.fetch(feed).getContentText();
  var root = XmlService.parse(xml).getRootElement();
  var atom = XmlService.getNamespace('http://www.w3.org/2005/Atom');

  var entries = root.getChildren('entry', atom);

  for (var i = 0; i < entries.length; i++) {
    var title = entries[i].getChild('title', atom).getText();
    var categoryElements = entries[i].getChildren('category', atom);

    var updated = entries[i].getChild('updated', atom).getValue();
    var url = entries[i].getChild('id', atom).getValue();
    var summary = entries[i].getChild('summary', atom).getText();
    var user = entries[i].getChildren('author', atom)[0].getChild('name', atom).getValue();
    var userURL = entries[i].getChildren('author', atom)[0].getChild('uri', atom).getValue();

    var regexSubSite = /http:\/\/(.*?).stackexchange\.com/.exec(url);
    var site, siteURL;

    if (!regexSubSite) {
      // If it's not a "subsite"...
      site = /http:\/\/(.*)\.com/.exec(url);
      site = site ? site[1] : 'noneFound';
      siteURL = site ? 'http://www.' + site + '.com' : 'noneFound';
    } else {
      site = regexSubSite[1];
      siteURL = regexSubSite[0];
    }

    // url     - Question URL
    // title   - Question Title
    // user    - Question Author
    // userURL - Author Profile URL
    // site    - Stack Exchange Site Name
    // siteURL - SE Site URL
  }
}

Also read Create Trello Cards from a Google Form with Google Scripts Easy Guide!



from thetechxp https://ift.tt/kWFQOma
via IFTTT

Comments

Popular posts from this blog

किस महानगर में मिल रहा सबसे सस्ता पेट्रोल? जानें तेल का नया भाव https://ift.tt/zKAj5k6

रोज की तरह आज यानि 9 दिसंबर को भी तेल के नए रेट जारी कर दिए गए हैं. जिसके अनुसार, पेट्रोल-डीजल की कीमतों में कोई बदलाव नहीं किया गया है. सभी राज्यों में वाहन ईंधन की कीमतें जस की तस हैं. आइये जानते हैं, किस महानगर में सबसे कम कीमत पर पेट्रोल मिल रहा है और देश के किस इलाके में सबसे सस्ता और सबसे महंगा पेट्रोल मिल रहा है. from आज तक https://ift.tt/o9nAWyY via IFTTT

Best Website For Finding Government Jobs

  Online Sarkari Job Find   is a reliable and comprehensive online platform dedicated to providing the latest information on job opportunities. Our mission is to assist job seekers in finding their ideal positions by offering timely alerts and notifications on the latest job openings, Sarkari Results, Sarkari Exams, Sarkari jobs, Sarkari networks, and Sarkari Naukri. Our team of dedicated professionals is committed to keeping you informed about the most recent developments in the employment sector. With our user-friendly interface and up-to-date content, we strive to ensure that you have access to accurate and reliable information regarding various government job vacancies. Website Link -  Online Sarkari Job Find

IPL: कप्तान बाहर, दिग्गज भी निकले... रिटेंशन ने कैसे बदल दिया टीमों का गणित https://ift.tt/L7Adk8F

आईपीएल के अगले सीजन के लिए 23 दिसंबर को कोच्चि में मिनी ऑक्शन का आयोजन होना है. इस नीलामी से पहले सभी 10 टीमों की ओर से रिटेंशन लिस्ट जारी कर दी गई. from आज तक https://ift.tt/LK4D2kX via IFTTT