मैं इस पृष्ठ पर प्रत्येक लिंक के लिए पृष्ठ विवरण पृष्ठ के पीछे स्क्रैप करना चाहता हूं।जावास्क्रिप्ट के साथ वेबसाइट से स्क्रैपिंग टेबल: सब ओपेन href लिंक
मैं इस पृष्ठ पर सभी जानकारियां प्राप्त कर सकते हैं:
href="javascript:subOpen('9ca8ed0fae15d43dc1257e7300345b99')"
: PAGE
हालांकि, मैं सभी जानकारी विवरण पृष्ठ पर है, लेकिन href लिंक है कि तरह लग रहा है, उदाहरण के लिए प्राप्त करना चाहते हैं सामान्य अवलोकन पाने के लिए ImportHTML
फ़ंक्शन का उपयोग करके मेरा नमूना स्प्रेडशीट यहां दिया गया है।
कोई सुझाव कैसे विवरण पृष्ठों पाने के लिए?
अद्यतन
मैं विधि निम्नलिखित कार्यान्वित:
function doGet(e){
var base = 'http://www.ediktsdatei.justiz.gv.at/edikte/ex/exedi3.nsf/'
var feed = UrlFetchApp.fetch(base + 'suche?OpenForm&subf=e&query=%28%5BVKat%5D%3DEH%20%7C%20%5BVKat%5D%3DZH%20%7C%20%5BVKat%5D%3DMH%20%7C%20%5BVKat%5D%3DMW%20%7C%20%5BVKat%5D%3DMSH%20%7C%20%5BVKat%5D%3DGGH%20%7C%20%5BVKat%5D%3DRH%20%7C%20%5BVKat%5D%3DHAN%20%7C%20%5BVKat%5D%3DWE%20%7C%20%5BVKat%5D%3DEW%20%7C%20%5BVKat%5D%3DMAI%20%7C%20%5BVKat%5D%3DDTW%20%7C%20%5BVKat%5D%3DDGW%20%7C%20%5BVKat%5D%3DGA%20%7C%20%5BVKat%5D%3DGW%20%7C%20%5BVKat%5D%3DUL%20%7C%20%5BVKat%5D%3DBBL%20%7C%20%5BVKat%5D%3DLF%20%7C%20%5BVKat%5D%3DGL%20%7C%20%5BVKat%5D%3DSE%20%7C%20%5BVKat%5D%3DSO%29%20AND%20%5BBL%5D%3D0').getContentText();
var d = document.createElement('div'); //assuming you can do this
d.innerHTML = feed;//make the text a dom structure
var arr = d.getElementsByTagName('a') //iterate over the page links
var response = "";
for(var i = 0;i<arr.length;i++){
var atr = arr[i].getAttribute('onclick');
if(atr) atr = atr.match(/subOpen\((.*?)\)/) //if onclick calls subOpen
if(atr && atr.length > 1){ //get the id
var detail = UrlFetchApp.fetch(base + '0/'+atr[1]).getContentText();
response += detail//process the relevant part of the content and append to the reposnse text
}
}
return ContentService.createTextOutput(response);
}
हालांकि, जब विधि चल मैं एक त्रुटि मिलती है:
ReferenceError: "document" is not defined. (line 6, file "")
document
एक क्या है की वस्तु?
मैंने वेबपैप के साथ Google Spreadsheet अपडेट किया है।
मैं आपके उत्तर की सराहना करता हूं!
[इस प्रश्न] का डुप्लिकेट (http://stackoverflow.com/questions/31452272/google-app-script-urlfetch-not-giving-html-output-but-javascript-ouput)। आपके जवाब के लिए – Mogsdad