How to make a web crawler in node.js

I want to make a web crawler, where it takes memes from giphy and shows it on a html page but i couldn’t get the api working so does anyone have a solution to this problem??

I tried to use Giphy API but it didn’t work 🙁
I also tried to use Giphy Embed Code, it worked but, it only ouputed the urls of the meme rather than the image/gif

I tried to fix it but it didn’t work out, then i even tried to use chat-gpt to see if there was any errors but tht also didn’t work….

i didn’t go more than this…..

Images not displaying in mobile phones and only images called dynamically are displaying ..under desktop view images are displaying

All the images are not displaying for my entire website when i am viewing in mobile phone , only the images called dynamically are showing in mobiles. i dnt know why this is happeing only in mobiles. I can see all the images in desktop view. When i used to see mobile inspect view and inspected on one of the images. its showing script tag of cloudflare.com/mirage2.min.js and has been added a style display:none; visibility:hidden automatically with data-cfsrc=”images/logo.png” and data-cfsrc=”width:200px”. and the original img tag with src is added inside tag. plz help me to view the images in mobile phone. its really very urgent for me.

url of my website: https://beta.destina1.com/#/

Plz help me to display the images in mobile view.

Why is assigning a value to super in the constructor in the ES6 standard? It is assigning a value to an instance of the class

class A {
  constructor() {
    this.x = 1;
  }
}
class B extends A {
  constructor() {
    super();
    this.x = 2;
    super.x = 3;
    console.log(super.x); // undefined
    console.log(this.x); // 3
  }
}
let b = new B();

Why is assigning a value to super in the constructor in the ES6 standard? It is assigning a value to an instance of the class.
Why is super.x undefined while this.x is 3

Please check this error for me, even though I have tried many ways but it still doesn’t work

Everyone take a look for me, thank
I sat all day searching and checking for errors but couldn’t
Hope everyone can help me, thank you
im use vision 8.2.2
I have tried many times but it doesn’t work. I hope you can share and help me find the error
Add any details you missed and read through it again. Now is a good time to make sure that your title still describes the problem!

In Gradient Descent algorithm, how to induce -2*wx

[part of Gradient Descent algorithm]
(https://i.stack.imgur.com/iTBz6.png)

this.updateWeights = function() {
 
  let wx;
  let w_deriv = 0;
  let b_deriv = 0;

  for (let i = 0; i < this.points; i++) {
    wx = this.yArr[i] - (this.weight * this.xArr[i] + this.bias);
    w_deriv += -2 * wx * this.xArr[i];
    b_deriv += -2 * wx;
  }
  
  this.weight -= (w_deriv / this.points) * this.learnc;
  this.bias -= (b_deriv / this.points) * this.learnc;
}
            

explain this part please!!

-2 * wx * this.xArr[i]

this part is induced….?

how to induce by math formula….

How do I make so i can login with numpad using username and password? JS

I’m making a project where i’m supposed to have an numpad to login users to their account. But i can’t really understand how I’m going to do that. The numpad from start displays “Enter your Account nnumber!”, and I want to make it understand that when it has got the correct account number, it should say “enter pin”. And if the pin is also correct it should log in and show the rest av the account. I’ve tried different stuff but i really cant make it do as i want. So if any of you got any help for me, I would be very greatful. I’m very novice to JS so the answer maybe is very simple but i don’t know.

type here

const users = [
    { accountNumber: '1337', pin: '1234', name: 'Mr Ibrahimovic', balance: 1000 },
    { accountNumber: '7331', pin: '5678', name: 'Mr Cooper', balance: 1000}
];

let islogin = false;
let whoIsLogin = -1;

let account = document.querySelector('.account');
account.style.display = 'none'

let bankomat = document.querySelector('.bankomat')

document.querySelector('.btn_login')
.addEventListener('click', () => {


    bankomat.style.display = 'none'
    account.style.display = 'block'

})

const screen = document.getElementById('screen');

const buttons = document.querySelectorAll('.btn');
console.log(buttons);

let numbers = '';
buttons.forEach(btn => {
    btn.addEventListener('click', (e) =>{
        numbers = numbers + e.target.value;
        screen.innerHTML = numbers;
    });
    
});

TypeError Cannot read properties of undefined (reading ‘please select a topic’)

please find attached the screenshot of the error

enter image description here

enter image description here

enter image description here

enter image description here

…………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………..

How to create a custom select component with options passed as HTML instead of props in Vue 3?

I am trying to create a custom select component that can accept options as HTML like this:

<MySelect v-model='value'>
  <MyOption value='1'>Option 1</MyOption>
  <MyOption value='2'>Option 2</MyOption>
</MySelect>

I have been looking through numerous websites and youtube videos, but have found nothing that achieves this. In all sources they pass options as an array in MySelect props. But I need more customization of options, such as adding an icon or applying styles to text. So, I would appreciate if you could share your ideas of how this can be implemented!

P.S. MySelect component should not contain native select and option tags. The whole purpose of creating a custom select component is for design customization.

CustomElementRegistry repeat registration error

I am using the googlemaps/extended-component-library to use two web components those being the APILoader and the PlacePicker components,

When i run my application it throws these errors:

'CustomElementRegistry' already has "gmpx-api-loader" defined. 
 ReferenceError: HTMLDivElement is not defined
    at __webpack_require__ (C:UsersuserDesktopDevelopmentProduct-Shop.nextserverwebpack-runtime.js:33:42) 

Steps to reproduce:

  1. create next app
  2. install googlemaps/extended-component-library
  3. import APILoader and PlacePicker components from googlemaps/extended-component-library and use them in your application
  4. provide APILoader with google api key
  5. run your application

From googling i have not found anyone with a similar problem or solution

Why this Post method returns a 405 error?

I am receiving a 405 Error when i try to use the post method from a booking engine for our small hotel website.
Here is the code that the booking engine provider asked us to integrate below and the temporary url of website with the booking engine in questions on home page.
https://nicolass-trendy-site-521bc7.webflow.io/
What are we doing wrong?
We used this HTML block for it.

<section id="hbe-bws-wrapper-widget-code"></section>
<link type="text/css" rel="stylesheet" href="//book.securebookings.net/css/search-wdg.css" />
<script type="text/javascript" src="//book.securebookings.net/js/widget.search.js"></script>
<script> 
jQuery(document).ready(function() {
             $widget("#hbe-bws-wrapper-widget-code").searchWidgetCode({
            id: "cdc12a82-35c5-1668031886-4530-b288-fdfc406a9e3e",
            lang: "en",
            Layout: 0,
            ShowPromoCode: 1,
            ShowFilterSearch: 1,
            ShowBestRate: 0,
            InsiteUrl: "https://nicolass-trendy-site-521bc7.webflow.io/reservation",
            ButtonName: "Check Availability",
            ButtonBackground: "#4391DA",
            ButtonText: "#FFFFFF",
            WidgetBackground: "#AA8453",
            urlS3Json:"new-hls"

            });
            });
</script>

href to another html file wont play media content

I am using the following code to open an html file on a new tab:

                <button class="interactive-transcript-button" title="Open Interactive Transcript in a new tab">
                
                <svg file>
                
                </button>
                </a>

The media element in the html file being opened is in:

  <section data-media-src="file:////Users/filepath.mp4" data-wm="$ilp.uphold.com/123section">

These html files work on their own, but when I try to hyperlink the second html file to open from the first one, the media file no longer works.

how to assign default value for arguments when using the new Function method

how to assign default value for arguments when using the new Function method?

let fileName = "fileone.js", args = [], options = {};
let ls = new Function('fileName', 'args', 'options', 'somefunctionorValue', `....some...code...body...here`)
ls(fileName, args, options)

I want to assign the default value for 'someFunctionOrValue' when the function I am creating is done: new Function(....).

cannot able to share an image with text using Navigator.share

I want to share an image with caption. here I have a code which generate an image dynamically with using html-to-image plugin. Everything works properly but the text get discarded while the image get share on Whatsapp, Facebook and etc.

And on the otherside if i pass two file as an image and try to share then text get included on both the image.

following is my code


getScoreImage() {
    this.dynamicImageEle = document.getElementById('quiz-share-image-wrap');

    const v_this = this;

        htmlToImage.toPng(this.dynamicImageEle)
        .then(function (dataUrl) {
        var img = new Image();
        img.src = dataUrl;
        v_this.dynamicImageBase64 = img.src;
        const file = v_this.dataURLtoFile(dataUrl, "ipl-quiz.png");

        setTimeout(()=> {
            v_this.shareFile(file);
        },100)
    })
    .catch(function (error) {
        console.error('oops, something went wrong!', error);
    });
}

dataURLtoFile(dataurl: any, filename:any) {
    var arr = dataurl.split(","),
        mimeType = arr[0].match(/:(.*?);/)[1],
        decodedData = atob(arr[1]),
        lengthOfDecodedData = decodedData.length,
        u8array = new Uint8Array(lengthOfDecodedData);
    while (lengthOfDecodedData--) {
        u8array[lengthOfDecodedData] = decodedData.charCodeAt(lengthOfDecodedData);
    }
    return new File([u8array], filename, { type: mimeType });
    
};

async shareFile(file:any) {
    if (navigator.canShare && navigator.canShare({ files: [file] })) {
        await navigator.share({
            "title": this.shareTitle,
            "text": this.shareText,
            "files": [file, file],
        })
        .then(() => console.log("Share was successful."))
        .catch((error) => console.log("Sharing failed", error));
    } else {
        console.log(`Your system doesn't support sharing files.`);
    }
};

Current Output with image and no text

If Pass two image then output is proper but 2 image is not expected

Expecting output I want to share is image with text.

How can I write this python function in javascript?

Im currently working on this code wars pisano period.
We need to return the length of the period by which you divide the fibonacci sequence.

The python code I searched for on youtube looks like this. Also its important to note that the python function returns the entire modulo version of the fibonacci sequence instead of the length
here is the youtube video from which I got this answer from Lets Python: Pisano

def pisanoPython(divisor):
  '''Returns a modulo version of the Fibonacci sequence'''
  fib = [0,1]
  while True:
     fib.append((fib[-1]+fib[-2]) % divisor)
     if fib[-1] == 1 and fib[-2] == 0:
        return fib[:-2]

>>>pisano(3)
[0,1,1,2,0,2,2,1]

Below is my code (which is giving me the wrong output)

function pisanoJavascript(n){
  let fib = [0,1];
  let isRepeated = true;
  while(isRepeated) {
    let lastVal = fib[fib.length-1]
    let secondLastVal = fib[fib.length-2]
    let remainder = (lastVal + secondLastVal) % n
    fib.push(remainder)
    if(lastVal === 1 && secondLastVal === 0) isRepeated = false
  }
  return fib.slice(0,-2).length
}

I followed the logic and the steps from the python function but can’t figure out which part I am missing.

I find that the line
if(lastVal === 1 && secondLastVal === 0) isRepeated = false. will always hit and break out of the while loop so maybe I need to initialize fib array in a different way. Why are these two functions not the same even though I followed the logic from pisanoPython and how can I make the javascript version work

how can I toggle items in a list in javascript?

I write the toggleSelectedItems function but it did not work correctly and I could not solve the problem.

when I click on add button, I want to send the items that are in candidateItems to selectedGroups and if I click on add all, the all items in groups are added to selectedGroups.if I click on remove, the items that are in candidateItems are removed from selectedGroups . I want when I send the items to the toggleSelectedItems function, if they exist, they will be removed from the selectedGroups state, and if they don’t exist, they will be added. the items should be add to the related group. the groupId of items are equal to id of each group in selectedGroups.how can I fix the toggleSelectedItems function?

for example

const groups =[
    {
        "title": "Clusters",
        "id": "clusters",
        "items": [
            {
                "id": 1,
                "label": "cluster1",
                "groupId": "selected-clusters"
            },
            {
                "id": 2,
                "label": "cluster2",
                "groupId": "selected-clusters"
            }
        ]
    },
    {
        "title": "Rigs",
        "id": "rigs",
        "items": [
            {
                "id": 1,
                "label": "rig1",
                "groupId": "selected-rigs"
            },
            {
                "id": 2,
                "label": "rig2",
                "groupId": "selected-rigs"
            },
            {
                "id": 3,
                "label": "rig3",
                "groupId": "selected-rigs"
            }, 
        ]
    }
]
const selectedGroups=[
    {
        "title": "Selected Clusters",
        "id": "selected-clusters",
        "items": []
    },
    {
        "title": "Selected Rigs",
        "id": "selected-rigs",
        "items": []
    }
]

const candidateItems=[
    {
        "id": 1,
        "label": "cluster1",
        "groupId": "selected-clusters"
    },
    {
        "id": 2,
        "label": "cluster2",
        "groupId": "selected-clusters"
    }
]

my code :

 type GroupType = {
  title: string
  id: string
  items: GroupItemType[]
}

 type GroupItemType = {
  id: string | number
  label: string
  groupId: string | number
}

const [groups, setGroups] = useState<GroupType[]>([])
const [selectedGroups, setSelectedGroups] = useState < GroupType[] > ([])
const [candidateItems, setCandidateItems] = useState < GroupItemType[] > ([])

 const toggleSelectedItems = useCallback(
    (toggleItems: GroupItemType[]) => {
      setSelectedGroups((prevGroups) =>
        prevGroups.map((group) => {
          const groupToggleItems = toggleItems.filter(
            (toggleItem) => toggleItem.groupId === group.id
          )

          if (groupToggleItems.length === 0) return group

          const itemExists = groupToggleItems.some((toggleItem) =>
            group.items.some((item) => item.id === toggleItem.id)
          )

          const updatedItems = itemExists
            ? group.items.filter(
                (item) =>
                  !groupToggleItems.some(
                    (toggleItem) => toggleItem.id === item.id
                  )
              )
            : [...group.items, ...groupToggleItems]

          return { ...group, items: updatedItems }
        })
      )
    },
    [selectedGroups]
  )
  
  const add = useCallback(() => {
    toggleSelectedItems(candidateItems)
    setCandidateItems([])
  }, [candidateItems])
  
  const addAll = useCallback(() => {
    const allItems = groups.flatMap((item) => item.items)
    toggleSelectedItems(allItems)
  }, [groups])
 
  const remove = useCallback(() => {
    toggleSelectedItems(candidateItems)
    setCandidateItems([])
  }, [candidateItems])
 
  const removeAll = useCallback(() => {
    const allItems = selectedGroups.flatMap((item) => item.items)
    toggleSelectedItems(allItems)
  }, [selectedGroups])