There are lots of resources for getting name, website, accreditation info, etc for higher education institutions such as the College Scorecard API or IPEDS. What I need for this project is to find a general contact information email address for my set of a few hundred colleges and universities. I plan on using Google Sheets and Apps Script to collect this data.
I have a spreadsheet such as
| Name | URL | City | State | Email |
|-----------------------|----------------------|-----------------|-------|-------|
| Prairie State College | www.prairiestate.edu | Chicago Heights | IL | |
| Langston University | www.langston.edu | Langston | OK | |
where I need to fill in the "email" column. Does anyone know any APIs that could help with that? A quick Google search tells me that ldickerson#prairiestate.edu is the contact at Prairie State College, whereas the admissions page of Langston University has luadmissions#langston.edu right on it. Does anyone have any ideas on where I can pull this data from automatically?
There is no direct API that can help you achieve that.
What you can do instead is to use UrlFetchApp from Apps Script and retrieve the page text from the admission/contact pages wanted. Afterwards you can retrieve the email address from the page text retrieved using regex.
The below code does the mentioned above but depending on the page, it may retrieve more than one email address. If you know exactly that the first email in the list is the email address you actually need, you can call email[0] instead.
function findMail() {
var url ="ADMISSION_CONTACT_PAGE_URL";
var pageText = UrlFetchApp.fetch(url).getContentText();
var email = pageText.match(/([a-zA-Z0-9._-]+#[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/gi);
Logger.log(email);
}
Reference
UrlFetchApp Class Apps Script;
Regex Tester.
Related
I am trying to create command that identifies the sitename and the username from the link. For example using !link https://en.wikipedia.org/wiki/User:Example, !link https://en.wikipedia.org/wiki/Special:Contributions/Example, or !link https://en.wikipedia.org/wiki/User_talk:Example would create an embed of
const embed = new Discord.MessageEmbed()
.setColor('#bf00ff')
.addTitle(`en.wikipedia.org`, [Wiki link](https://en.wikipedia.org/wiki/Main_Page))
.addField(`User info of Example`, `[Userpage](https://en.wikipedia.org/wiki/User:Example) | [User_talk](https://en.wikipedia.org/wiki/User_talk:Example) | [Logs](https://en.wikipedia.org/wiki/Special:Log/Example) | [User groups](https://en.wikipedia.org/wiki/Special:UserRights/Example) | [User contributions](https://en.wikipedia.org/wiki/Special:Contributions/Example) | [BlockLog](https://en.wikipedia.org/w/index.php?title=Special:Log/block&page=User:Example)
message.channel.send(embed)
Also, if the link doesn't have User:, Special:Contributions/, or User_talk:, as well as the sitename (e.g. en.wikipedia.org), and the username within it, then create an error message.
If the link contains ?useskin=monobook, ?useskin=vector, ?useskin=modern, or ?useskin=apex, which is after the username, ignore those part in the link. For example, https://en.wikipedia.org/wiki/User_talk:Example?useskin=vector should be interpreted as https://en.wikipedia.org/wiki/User_talk:Example, and the username should also be interpreted as Example, not Example?useskin=vector
How could I accomplish that?
As my role as tester (among all the things), I need to review log files for errors. Unfortunatly, the generated output file (file-YYYY-MM-DD.log) displays all kinds of information, not just the errors (or "things that go bad").
My question is; how do I hide the lines I don't want and generate an output file (log) containing the deviations (errors, warnings etc)?
For example, I want to hide:
| I | variable text I do not want, location: /path/to/foo/bar
| W | service X stopped
| W | service X started
The most ideal outcome with the script I want is:
-> Ask question: "Do you want to hide information and warning messages? |
-> Answer: yes --> hide all | I | message (like: no new foo's found in: /location/to/foo.
-> Answer: no --> do nothing (closes script)
The data is from an Unix environment, however the script is going to run in an Windows environment.
Thanks
I have different string for same businesses logic in cucumber.
So I trying to get a way to tag a multiple Gherkins string with one function.
I am trying with below but I m not able understand to formulate it with cucumber
Using #Repeatable while mainaining support for Java 7
Example:
Scenario Outline: Looking up the definition of fruits
the user is on the Wikionary home page for fruits
When the user looks up the definition of the word <name>
Then they should see the definition 'An edible fruit produced by the pear tree, similar to an apple but elongated towards the stem.'
Examples:
| name |
| pear |
Scenario Outline: Looking up the definition of orange
Given the user is on the Wikionary home page for orange
When the user looks up the definition of the word <name>
Then they should see the definition 'An edible fruit produced by the pear tree, similar to an apple but elongated towards the stem.'
Examples:
| name |
| pear |
In above statement Given is different but the business function is same.
How I can tag this with repeatable with java.
Or any other way except concatenate string with |
Any work around will be helpful!!!
Have a step definition like this - It should match any similar step and also non-capturing
#Given("^the user is on the Wikionary home page for (?:\\w+)$")
public void given() {
System.out.println("givn");
}
#Given("^should go to given (?:,*) $")
#Given("^should go to given - (.*?) - (?:,*) $")
#Given("^should go to given - (.*?) - (.*?) - (?:,*) $")
This will take in different parameters. But this will completely ruin the gherkin step text, make it total gibberish. Would be very uncomfortable using this.
You can write the Step Definition Java code only once for above both scenario it will automatically run the same step definition code for the two different scenarios:
Scenario Outline: Looking up the definition of fruits
Given the user is on the Wikionary home page for "fruits"
Scenario Outline: Looking up the definition of orange
Given the user is on the Wikionary home page for "orange"
For above #Given statement you can write only one step defination method it will automatically execute for both scenario as per the different parameters configuration:
#Given("the user is on the Wikionary home page for (.*))
public void given(String fruitName)
{
System.out.println(fruitName);
}
I am currently trying to get one site collection URL from my content db.
After researching I found:
How to see all site collections in a specific content DB
And after changing the accepted answer a tiny bit to get only 1 site collection and only the url and assigning it to a variable I have:
$mySiteURL = Get-SPSite -Limit 1 -ContentDatabase WSS_Content_DBNAME | select url
However, when I output this variable using Write-Host $mySiteURL I get:
#{Url=http://mysites.mydomain.local}
when I only want:
http://mysites.mydomain.local
How do I do this?
You have an object array with an URL property. To dissolve the object and retain just the string you can use -ExpandProperty
$mySiteURL = Get-SPSite -Limit 1 -ContentDatabase WSS_Content_DBNAME | select-object -expandproperty url
This is one of the common gotcha's of PowerShell.
Not a developer, new to Selenium IDE, and yes, limited to sticking with IDE only. Appreciate any and all help.
Trying to grab a password from an email generated upon Password Reset so the script can then log in with the new password.
Thought I'd do a split on a delimiter in the email content, Trim as necessary to grab the password. Running into problems with how to store the returned array. In order to do what I'm thinking, I need to store it back into an array that Selenium can traverse.
storeText | css=body | emailText
getEval | storeResults = javascript{storedVars['emailText'].split("delimiter")}
The getEval throws an "missing ; before statement" exception. Using method store instead of getEval works (and moving storeResults to a target), but then the results are typecast as a string. I feel I'm missing something very basic here.
I think the keyword javascript must be omitted
For me the following code works:
storeText | //*[#id="_currentProduct"] | myText
getEval | alert(storedVars['myText'])
When run the alertbox has the value of myText.
Thanks for the response. I came to the same conclusion. Here's the working code:
getEval | storeResults = storedVars['emailText'].split("delimiter")
Was able to access the stored value this way:
LOG.info(storeResults[1])