Hello Everyone im new here but i hope i can get some help i would really appreciate it thank you

So basically the code refreshes twitter until a keyword is scanned then the program clicks on the link in the tweet, the problem is that the link that is being clicked is not the link that i want the program to click because the tweet has two links in it i dont know how to fix this problem

please test out the extension so you could understand what i mean.

IF YOU ARE GOING TO TEST THE CODE CREARE THESE TWO FILES SETS OF CODE AND SAVE THEM WITH THE CORRESPONDING NAME AND THEN PLACE THEM BOTH IN ONE FOLDER AND WITH GOOGLE CHROME ADD THE FOLDER TO EXTENSIONS UNDER TOOLS IN GOOGLE CHROME

TEST ON https://twitter.com/nikestore

This code is named twitterscan.js

Code:
var shoeName = "Foamposite";

var nikestore = "nikestore";

var closeFlag = "no";

var tFunction = "twitterScan()";

var tweet = new Array();

var tweetName = new Array();



function twitterScan() {

	

	for (var i = 0; i < 4; i++) {

		tweetName[i] = document.getElementsByClassName("fullname js-action-profile-name show-popup-with-id")[0].innerHTML;

		tweet[i] = document.getElementsByClassName("js-tweet-text")[i].innerHTML;

		

	}





	//if (document.getElementsByClassName("fullname js-action-profile-name show-popup-with-id")[0].innerHTML;



	if (tweet[0].match(shoeName) == shoeName) {

		document.getElementsByClassName("twitter-timeline-link")[0].click();

		tFunction = "get outa here";

		shoeName = " 4444  4 456 7 8 456 7 345 7 345  345 3 1 1 133s "; //buffer to jump out of interval loop

		

	} 



	else if (tweet[1].match(shoeName) == shoeName) {

		document.getElementsByClassName("twitter-timeline-link")[1].click();

		tFunction = "get outa here";

		shoeName = " 4444  4 456 7 8 456 7 345 7 345  345 3 1 1 133s "; //buffer to jump out of interval loop

		

	}



	else if (tweet[2].match(shoeName) == shoeName) {

		document.getElementsByClassName("twitter-timeline-link")[2].click();

		tFunction = "get outa here";

		shoeName = " 4444  4 456 7 8 456 7 345 7 345  345 3 1 1 133s "; //buffer to jump out of interval loop

		

	}





	else if (tweet[3].match(shoeName) == shoeName) {

		document.getElementsByClassName("twitter-timeline-link")[3].click();

		tFunction = "get outa here";

		shoeName = " 4444  4 456 7 8 456 7 345 7 345  345 3 1 1 133s "; //buffer to jump out of interval loop

		

	}

	



	else {

		location.reload(true);

	}

	

	setTimeout(tFunction, 700);



	

}



setTimeout(tFunction, 700);



//setInterval("refreshPage()", 3000);

//setTimeout("twitterScan()", 100);

//setInterval(tFunction, 700);
This code is named manifest.json

Code:
{
  "name": "Twitter",
  "manifest_version": 2,
  "version": "1",
  "content_scripts": [
    {
      "matches": ["*://twitter.com/*"],
      "js": ["twitterscan.js"]
    }
  ], "permissions": [
    "tabs" , "*://twitter.com/*"
  ]
}