How to fetch latest Apple podcast date with Google Sheets? - google-sheets

I have a spreadsheet with Apple Podcasts URLs.
What I want to do is to get newest podcast date.
So basically content of "sort-value" tag of first grid cell element:
<td role="gridcell" sort-value="2017/12/22" class="release-date">
Can it be done with IMPORTHTML function?
Example podcast URL: https://itunes.apple.com/us/podcast/modern-sewciety-podcast/id742393907

How about this?
=INDEX(IMPORTXML(A1, "//td[#class='release-date']//span[#class='text']"), 1)
https://itunes.apple.com/us/podcast/modern-sewciety-podcast/id742393907 is in a cell "A1".
XPath is //td[#class='release-date']//span[#class='text'].
The top value is retrieved using INDEX.
Edit :
About the reason that the value of cell becomes 43091, It is considered that it is due to the cell format. In order to modify this situation, please try the following 2 patterns.
Modify the format for the cell with 43091.
On the spreadsheet, please select "Format" -> "Number" -> "Date"
If you want to other date format, please customize it.
Use this XPath.
=INDEX(IMPORTXML(A1, "//td[#class='release-date']/#sort-value"), 1)
In this XPath, the format of date is different from //td[#class='release-date']//span[#class='text'].

I can't give the specifics for Google Sheets, but I can tell you that you can more quickly get this data from using the Apple Media Lookup API.
Using the ID number, 742393907, make a call to this API endpoint: https://itunes.apple.com/lookup?id=742393907
That will return the following JSON:
{
"resultCount": 1,
"results": [
{
"wrapperType": "track",
"kind": "podcast",
"collectionId": 742393907,
"trackId": 742393907,
"artistName": "Stephanie Kendron: Modern Creative blogger and podcaster",
"collectionName": "Modern Sewciety Podcast",
"trackName": "Modern Sewciety Podcast",
"collectionCensoredName": "Modern Sewciety Podcast",
"trackCensoredName": "Modern Sewciety Podcast",
"collectionViewUrl": "https://podcasts.apple.com/us/podcast/modern-sewciety-podcast/id742393907?uo=4",
"feedUrl": "http://www.modernsewciety.com/feed/podcast",
"trackViewUrl": "https://podcasts.apple.com/us/podcast/modern-sewciety-podcast/id742393907?uo=4",
"artworkUrl30": "https://is5-ssl.mzstatic.com/image/thumb/Podcasts113/v4/db/f3/1d/dbf31d7f-3fae-84a6-c4b6-91adebc2394d/mza_4725542195606703711.jpg/30x30bb.jpg",
"artworkUrl60": "https://is5-ssl.mzstatic.com/image/thumb/Podcasts113/v4/db/f3/1d/dbf31d7f-3fae-84a6-c4b6-91adebc2394d/mza_4725542195606703711.jpg/60x60bb.jpg",
"artworkUrl100": "https://is5-ssl.mzstatic.com/image/thumb/Podcasts113/v4/db/f3/1d/dbf31d7f-3fae-84a6-c4b6-91adebc2394d/mza_4725542195606703711.jpg/100x100bb.jpg",
"collectionPrice": 0.00,
"trackPrice": 0.00,
"trackRentalPrice": 0,
"collectionHdPrice": 0,
"trackHdPrice": 0,
"trackHdRentalPrice": 0,
"releaseDate": "2020-03-08T16:39:00Z",
"collectionExplicitness": "cleaned",
"trackExplicitness": "cleaned",
"trackCount": 50,
"country": "USA",
"currency": "USD",
"primaryGenreName": "Design",
"contentAdvisoryRating": "Clean",
"artworkUrl600": "https://is5-ssl.mzstatic.com/image/thumb/Podcasts113/v4/db/f3/1d/dbf31d7f-3fae-84a6-c4b6-91adebc2394d/mza_4725542195606703711.jpg/600x600bb.jpg",
"genreIds": [
"1402",
"26",
"1301"
],
"genres": [
"Design",
"Podcasts",
"Arts"
]
}
]
}
You would want the releaseDate field, which is pulled from the podcast's latest episode.

Related

Getting labels from Planner with Microsoft Graph API

Is it possible to get the labels and priority from a Microsoft Planner task with the Microsoft Graph API?
See screenshot below to have an idea:
Using next endpoint: https://graph.microsoft.com/v1.0/planner/plans/<plan-id>/tasks I get next data:
{
"#odata.etag": "W/\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBBWCc=\"",
"planId": "r4g58er4grregrg7848",
"bucketId": "64g8df54hhktohk487",
"title": "Title of a task",
"orderHint": "545457845775LM",
"assigneePriority": "",
"percentComplete": 0,
"startDateTime": null,
"createdDateTime": "2022-01-07T13:58:14.5355148Z",
"dueDateTime": null,
"hasDescription": true,
"previewType": "description",
"completedDateTime": null,
"completedBy": null,
"referenceCount": 0,
"checklistItemCount": 1,
"activeChecklistItemCount": 3,
"conversationThreadId": null,
"id": "grejgopreg645647",
"createdBy": {
"user": {
"displayName": null,
"id": "74463467-d67d-4512-9086-c9e279dde6ae"
}
},
"appliedCategories": {
"category5": true
},
"assignments": {}
}
I've next comments on this JSON:
What is assigneePriority? When a priority is filled in, will always be an empty string.
What is appliedCategories? Can these categories being used for the labels? But what is category5?
While it's not the most straightforward answer, you can figure out what labels are assigned to a task. You'll need both the planid and taskid to get it.
The appliedCategories are actually the labels applied to a particular task. Their identifieres are just category##. To find the corresponding label name, you'll need to make a call to get the plan details.
Graph API URL: https://graph.microsoft.com/beta/planner/plans/{planid}/details
This will return a JSON object containing each of the categories and their descriptions. You can find more info here about the plannerPlanDetails type. Note: the v1.0 graph endpoint only returns the first 6 categories, while the beta version will return 25.
"categoryDescriptions": {
"category1": "Some name",
"category2": "Some other name",
"category3": "Another",
"category4": null,
...
"category25": null
}
Within the task details, appliedCategories object will contain any labels assigned to that task.
For the priority, you will find a priority property on the task object when using the beta version of the endpoint. It's an integer, but from my testing, the following are the corresponding priority titles
9 - Low
5 - Important
3 - Medium
1 - Urgent
You'll have to do some correlation on your own to match them up, but this is how you can get the information you're looking for.

How to get only matched data from nested class using query builder in elastic search?

I am trying to get only the matched data from nested array of elastic search class. but I am not able to get it..the whole nested array data is being returned as output.
this is my Query:-
QueryBuilders.nestedQuery("questions",
QueryBuilders.boolQuery()
.must(QueryBuilders.matchQuery("questions.questionTypeId", quesTypeId)), ScoreMode.None)
.innerHit(new InnerHitBuilder());
I am using querybuilders to get data from nested class.Its working fine but not able to get only the matched data.
Request Body :
{
"questionTypeId" : "MCMC"
}
when questionTypeId = "MCMC"
this is the output i am getting..Here I want to exclude the output for which the questionTypeId = "SCMC".
output :
{
"id": "46",
"subjectId": 1,
"topicId": 1,
"subtopicId": 1,
"languageId": 1,
"difficultyId": 4,
"isConceptual": false,
"examCatId": 3,
"examId": 1,
"usedIn": 1,
"questions": [
{
"id": "46_31",
"pid": 31,
"questionId": "QID41336691",
"childId": "CID1",
"questionTypeId": "MCMC",
"instruction": "This is a single correct multiple choice question.",
"question": "Who holds the most english premier league titles?",
"solution": "Manchester United",
"status": 1000,
"questionTranslation": []
},
{
"id": "46_33",
"pid": 33,
"questionId": "QID41336677",
"childId": "CID1",
"questionTypeId": "SCMC",
"instruction": "This is a single correct multiple choice question.",
"question": "Who holds the most english premier league titles?",
"solution": "Manchester United",
"status": 1000,
"questionTranslation": []
}
]
}
As you have tagged this with spring-data-elasticsearch:
Support to return inner hits was recently added to version 4.1.M1 and so will be included in the next released version. Then in a SearchHit you will get the complete top level document, but in the innerHits property only the matching inner hits will be returned.

How to create Neo4J relationship between nodes yelp dataset

I am new to Neo4j. I am trying to populate Yelp dataset in Neo4j. Basically, I am interested in three json file provided by them i.e.
user.json
{
"user_id": "-lGwMGHMC_XihFJNKCJNRg",
"name": "Gabe",
"review_count": 277,
"yelping_since": "2014-10-31",
"friends": ["Oa84FFGBw1axX8O6uDkmqg", "SRcWERSl4rhm-Bz9zN_J8g", "VMVGukgapRtx3MIydAibkQ", "8sLNQ3dAV35VBCnPaMh1Lw", "87LhHHXbQYWr5wlo5W7_QQ"],
"useful": 45,
"funny": 4,
"cool": 55,
"fans": 17,
"elite": [],
"average_stars": 4.72,
"compliment_hot": 5,
"compliment_more": 1,
"compliment_profile": 0,
"compliment_cute": 1,
"compliment_list": 0,
"compliment_note": 11,
"compliment_plain": 20,
"compliment_cool": 15,
"compliment_funny": 15,
"compliment_writer": 1,
"compliment_photos": 8
}
I have omitted several entries from friends array to make output readable
business.json
{
"business_id": "YDf95gJZaq05wvo7hTQbbQ",
"name": "Richmond Town Square",
"neighborhood": "",
"address": "691 Richmond Rd",
"city": "Richmond Heights",
"state": "OH",
"postal_code": "44143",
"latitude": 41.5417162,
"longitude": -81.4931165,
"stars": 2.0,
"review_count": 17,
"is_open": 1,
"attributes": {
"RestaurantsPriceRange2": 2,
"BusinessParking": {
"garage": false,
"street": false,
"validated": false,
"lot": true,
"valet": false
},
"BikeParking": true,
"WheelchairAccessible": true
},
"categories": ["Shopping", "Shopping Centers"],
"hours": {
"Monday": "10:00-21:00",
"Tuesday": "10:00-21:00",
"Friday": "10:00-21:00",
"Wednesday": "10:00-21:00",
"Thursday": "10:00-21:00",
"Sunday": "11:00-18:00",
"Saturday": "10:00-21:00"
}
}
review.json
{
"review_id": "VfBHSwC5Vz_pbFluy07i9Q",
"user_id": "-lGwMGHMC_XihFJNKCJNRg",
"business_id": "YDf95gJZaq05wvo7hTQbbQ",
"stars": 5,
"date": "2016-07-12",
"text": "My girlfriend and I stayed here for 3 nights and loved it.",
"useful": 0,
"funny": 0,
"cool": 0
}
As we can see in the sample files that relationship between user and business is associated via the review.json file. How can I create a relationship edge between user and business using the review.json file.
I have also seen Mark Needham tutorial where he has shown StackOverflow data population but in that case, relationship file was already present with sample data. Do I need to build a similar file? If yes, how should I approach this problem? or is there any other way to build relationship between user & business?
It very much depends on your model as to what you want to do, but you could do 3 imports:
//Create Users - does assume the data is unique
CALL apoc.load.json('file:///c://temp//SO//user.json') YIELD value AS user
CREATE (u:User)
SET u = user
then add the businesses:
CALL apoc.load.json('file:///c://temp//SO//business.json') YIELD value AS business
CREATE (b:Business {
business_id : business.business_id,
name : business.name,
neighborhood : business.neighborhood,
address : business.address,
city : business.city,
state : business.state,
postal_code : business.postal_code,
latitude : business.latitude,
longitude : business.longitude,
stars : business.stars,
review_count : business.review_count,
is_open : business.is_open,
categories : business.categories
})
For the businesses, we can't just do the SET b = business because the JSON has nested maps. So you might want to decide if you want them, and might have to go down a different route.
Lastly, the reviews, which is where we join it all up.
CALL apoc.load.json('file:///c://temp//SO//review.json') YIELD value AS review
CREATE (r:Review)
SET r = review
WITH r
//Match user to a review
MATCH (u:User {user_id: r.user_id})
CREATE (u)-[:HAS_REVIEW]->(r)
WITH r, u
//Match business to a review, and a user to a business
MATCH (b:Business {business_id: r.business_id})
//Merge here in case of multiple reviews
MERGE (u)-[:HAS_REVIEWED]->(b)
CREATE (b)-[:HAS_REVIEW]->(r)
Obviously - change labels/relationships to types you want, and it might need tuning depending on the size of data etc, so you might need to use apoc.periodic.iterate to work it.
Apoc is here if you need it (and you should use it!)

iTunes RSS Feed always returns duration=30000

I'm using the following link in order to get top 10 songs from iTunes for USA:
https://itunes.apple.com/us/rss/topsongs/limit=10/explicit=true/json
I need to have every song's duration, but I always receive value 30000 for duration:
"im:duration": {
"label": "30000"
}
What does it mean, and is there a way to get the right duration value? Thanks.
I used this online time calculator and the sum of all songs's duration is 37.97 minutes; Checking a song sample Setting the World on Fire (with P!nk).
I think that 30000 is just the value of the sample duration. The RSS link that you provided doesn't contain the duration of the song(s) as is shown in the ITunes website.
If you really need the real duration of the songs, you have to use another way of get this information.
I tried use "The Widget Builder" and select "ITunes Search".
Here, when you use the widget for search a song (example: type dile), if you debug in the "Network" tab, you will get this URL:
https://itunes.apple.com/search?limit=20&country=us&media=music&entity=song&term=dile&callback=jQuery183020996109495104198_1478097762593&_=1478097910165
The results are:
{
"wrapperType": "track",
"kind": "song",
"artistId": 65630139,
"collectionId": 76542569,
"trackId": 76542586,
"artistName": "Don Omar",
"collectionName": "The Last Don",
"trackName": "Dile",
"collectionCensoredName": "The Last Don",
"trackCensoredName": "Dile",
"artistViewUrl": "https://itunes.apple.com/us/artist/don-omar/id65630139?uo=4",
"collectionViewUrl": "https://itunes.apple.com/us/album/dile/id76542569?i=76542586&uo=4",
"trackViewUrl": "https://itunes.apple.com/us/album/dile/id76542569?i=76542586&uo=4",
"previewUrl": "http://a1801.phobos.apple.com/us/r1000/136/Music7/v4/49/06/fe/4906fee2-16c0-9e99-64e9-e2d39c58b2b5/mzaf_6968581882856624700.plus.aac.p.m4a",
"artworkUrl30": "http://is4.mzstatic.com/image/thumb/Music5/v4/d3/b3/6c/d3b36c67-3b50-f55e-df74-9febe37c80f9/source/30x30bb.jpg",
"artworkUrl60": "http://is4.mzstatic.com/image/thumb/Music5/v4/d3/b3/6c/d3b36c67-3b50-f55e-df74-9febe37c80f9/source/60x60bb.jpg",
"artworkUrl100": "http://is4.mzstatic.com/image/thumb/Music5/v4/d3/b3/6c/d3b36c67-3b50-f55e-df74-9febe37c80f9/source/100x100bb.jpg",
"collectionPrice": 9.99,
"trackPrice": 1.29,
"releaseDate": "2003-06-17T07:00:00Z",
"collectionExplicitness": "notExplicit",
"trackExplicitness": "notExplicit",
"discCount": 1,
"discNumber": 1,
"trackCount": 15,
"trackNumber": 4,
"trackTimeMillis": 204600,
"country": "USA",
"currency": "USD",
"primaryGenreName": "Latin Urban",
"isStreamable": true
}
There, you get the trackTimeMillis property.
Hope it helps.

How to get the count of numbers like and reached in iOS iPhone Couchbase?

How does it work in iOS? Currently using Objective C.
Created in Document.
LIKE
{
"_id": "",
"userEmail": "",
"broadcastID": "",
"like": "",
"count": 0,
"type": "like"
}
and
REACH
{
"_id": "",
"userEmai": "",
"broadcastID": "",
"reach": "",
"count": 0,
"type": "reach"
}
Thank you in advance :)
Count Numbers of Likes/Reached
A typical approach would be to create a view with a map function that emits (places into the index) the values you care about. You can then run queries based on the view to further refine the information you retrieve.
Between the map function and query options, you have a lot of control over the information you retrieve. For example, you already have a 'type' field, so it's easy to have your map function only produce output for documents of the correct type.

Resources