Advertisement
Javi

Preguntas

Oct 29th, 2021
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. https://pegacert.com/vendor/aws/
  2.  
  3. urls = [...document.querySelectorAll('div.row > div > a')].map(e => e.href.replace('/vendor', '/page-data/vendor') + '/' + 'page-data.json')
  4.  
  5.  
  6. questions = await Promise.all(urls.map(async (u) => {
  7. resp = await fetch(u);
  8. json = await resp.json();
  9. return json.result.pageContext.question;
  10. }));
  11.  
  12. exam = questions.map(q => { return {
  13. id : q.id,
  14. text: q.description.map(d => d.text).join('\r\n'),
  15. answers : q.choices.map(a => a.text.map(t=> t.text).join('\r\n'))
  16. }});
  17.  
  18. https://pegacert.com/vendor/microsoft/az-900
  19.  
  20. urls = [...document.querySelectorAll('div.row > div > a')].map(e => e.href.replace('/vendor', '/page-data/vendor') + '/' + 'page-data.json')
  21.  
  22.  
  23. questions = await Promise.all(urls.map(async (u) => {
  24. resp = await fetch(u);
  25. json = await resp.json();
  26. return json.result.pageContext.question;
  27. }));
  28.  
  29. exam = questions.map(q => { return {
  30. id : q.id,
  31. text: q.description.map(d => d.text).join(),
  32. answers : q.choices?.map(a => a.text.map(t=> t.text).join('\r\n')),
  33. image : q.image
  34. }});
  35.  
  36. imgUrl = 'https://pegacert.s3-ap-southeast-1.amazonaws.com/microsoft/az-900/b1945/images/';
  37. images = [...new Set(questions
  38. .filter(q=>q.image)
  39. .map(q => 'wget ' + imgUrl + q.image + '.png'))]
  40. .join('\r\n')
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement