简体   繁体   English

关于如何提取喜欢的Pandora并将其放入电子表格的任何提示? (C ++ / C#)

[英]Any tips on how i would go about extract Pandora likes and putting them on a spreadsheet? (C++/C#)

Fairly new to coding and i want a project to work on that could help me advance my skills. 编码工作还很陌生,我希望可以从事一个项目,这可以帮助我提高技能。 I'm not sure what language would be best for this sort of undertaking but i would definitely prefer to use C++ or C#. 我不确定哪种语言最适合这种工作,但是我绝对会喜欢使用C ++或C#。

For the first part of the program i basically would like to try and take all my pandora likes and put them on a spreadsheet with song name is one column and artist in the other. 对于该程序的第一部分,我基本上想尝试将所有喜欢的pandora放到电子表格中,歌曲名称是一列,艺术家是另一列。 I don't see the formatting being too hard once i actually get the data i need, but i'm not really sure how to communicate with a server at all in this point in time. 我一看到实际需要的数据,就不会觉得格式化太费力,但是我现在还不确定如何与服务器进行通信。 I'm guessing i probably won't be able to grab a raw list of likes so the i'm thinking my best course of action will be to first expand the likes list all the way, and then i need to read the text on the screen ro in the source code. 我想我可能无法获取喜欢的原始列表,所以我认为我的最佳做法是首先一直扩展喜欢的列表,然后我需要阅读全文屏幕显示在源代码中。

For the first step, expanding my like i found the HTML source code that actually does this: 第一步,像我一样展开,我发现实际执行此操作的HTML源代码:

<div class="show_more tracklike" data-nextLikeStartIndex="0" data-nextThumbStartIndex="5">Show more</div>"

Not sure if this is something i can work with but i was thinking if i could set data-nextThumbStartIndex="5" to be equal to the # of likes - 5 (the amount it shows by default) it would be fairly easy to expand the list. 不知道这是否是我可以使用的东西,但是我在考虑是否可以将data-nextThumbStartIndex =“ 5”设置为点赞次数-5(默认情况下显示的数量),扩展起来会很容易名单。 If not i would probably have to click the "show more" link repeatedly until i have all the likes on the page. 如果不是这样,我可能不得不反复单击“显示更多”链接,直到页面上所有喜欢的人为止。

For the next step, getting the data i want, i think my best option would be to basically just grab the text that i physically see on the screen and worry about filtering and manipulating the data afterwards. 对于下一步,获取我想要的数据,我认为我最好的选择是基本上只获取我实际在屏幕上看到的文本,然后再担心过滤和处理数据。 The other option is looking at the source code, which i actually found the pieces of code where the info i want is stored. 另一个选择是查看源代码,我实际上在其中找到了我想要的信息存储的代码段。 If i could retrieve the page's source code i think it would be relatively easy to pick out the data i actually want from that. 如果我可以检索页面的源代码,我认为从中挑选出我真正想要的数据将相对容易。

So yea that's about it, i know i'm pretty noob atm and what i'm saying is probably wrong and/or much more complicated than i think but i'm a pretty quick learner and at the very least if someone could point me in the right direction to communicate with a server that would be much appreciated. 所以,是的,我知道我是一个非常漂亮的菜鸟,而且我说的可能是错误的,并且/或者比我想的要复杂得多,但是我是一个非常快速的学习者,至少如果有人可以指出我的话,与服务器通信的正确方向将不胜感激。

This question is quite "wide" (and I have absolutely no knowledge of Pandora itself - can't access it from where I live). 这个问题相当“广泛”(而且我完全不了解Pandora本身-无法从我居住的地方访问它)。

In general, there are several different ways to solve this type of problem: 通常,有几种不同的方法可以解决此类问题:

  1. Screen Scraping - basically access the website as if you were a web-server, and from the HTML string that comes back, dig out the information you need. 屏幕抓取-基本上就像访问Web服务器一样访问网站,然后从返回的HTML字符串中找出所需的信息。 The problem here is that the data is not very suitable for "machine reading", as it often has no distinct points for the "reader" to find the relevant information, and it's difficult to sort the data from the "chaff". 这里的问题是数据不是很适合“机器读取”,因为“读取器”通常没有明确的点来找到相关信息,并且很难从“包夹”中对数据进行排序。

  2. AJAX api - "Asynchronous Java Script and XML" where the provider of the website has an interface to fetch certain data within to the web-browser - of course, if you "pretend" to be the web-browser, requesting the same type of information. AJAX api-“异步Java脚本和XML”,其中网站的提供者具有一个接口,可将某些数据提取到网络浏览器中-当然,如果您“假装”成为网络浏览器,则请求相同类型的信息。 You are relying on the website to have such an interface, but if it exists, the data is generally in a "more suitable form to be machine read" (typically XML, but not always). 您依赖于网站具有这样的界面,但是如果存在,则数据通常采用“更适合机器读取的形式”(通常为XML,但并非总是如此)。

  3. JSON api - "Java Script Object Notation" is a similar solution to AJAX - like XML, JSON is a "human and machine readable format". JSON api-“ Java Script Object Notation”是与AJAX类似的解决方案-像XML一样,JSON是一种“人类和机器可读的格式”。

The latter two are definitely preferable, as the data coming back is meant for machine reading. 后两个绝对是更好的选择,因为返回的数据用于机器读取。 The drawback is that you need to have "server side cooperation". 缺点是您需要“服务器端合作”。 The good thing here is that Pandora does have a JSON API. 这里的好处是Pandora确实具有JSON API。 The bad thing is that it seems to be hard to use... Here's one discussion on the subject: Making JSON calls to Unoffical Pandora API 不好的是,它似乎很难使用...这是一个有关此主题的讨论: 对非官方Pandora API进行JSON调用

The main principle here is that you send some stuff to the webserver, and receive a reply with the requested information. 这里的主要原理是您将一些东西发送到Web服务器,并收到包含所请求信息的回复。 Exactly how this is done depends on the language/programming environment. 确切的完成方式取决于语言/编程环境。 A popular C++ solution is libcurl. 流行的C ++解决方案是libcurl。

There is a Ruby Client here, using the JSON interface https://github.com/nixme/pandora_client 这里有一个Ruby Client,使用JSON接口https://github.com/nixme/pandora_client

AC# implementation to interface with Pandora is here: http://pandoraunleashed.googlecode.com/svn/trunk/PandoraUnleashed/Pandora.cs 与潘多拉(Pandora)接口的AC#实现在这里: http : //pandoraunleashed.googlecode.com/svn/trunk/PandoraUnleashed/Pandora.cs

Unfortunately, I can't find any direct reference to "listing likes". 不幸的是,我找不到直接引用“列出喜欢”的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我将如何处理? 不同项目沟通? C# - How would I go about this? Different projects communicating? C# 按下任意键后,您将如何刷新应用程序? C# - How would you go about refreshing your application once you have pressed any key? C# 我将如何使用c#中的Powershell对象进行错误处理? - How would I go about error handling with a Powershell object in c#? 我将如何改变 Rider IDE 格式化我的 C# 代码的方式? - How would I go about changing the way the Rider IDE formats my C# code? C# 我将如何将多个客户端连接到同一台服务器? - C# How would I go about connecting multiple clients to the same server? 我将如何在C#中实现Java代码,反之亦然? - How would I go about implementing java code in c# and vice versa? 我将如何使用OpenTK C#创建六边形棱镜? - How would I go about creating a hexagonal prism using OpenTK C#? 如何关闭C#控制台应用程序执行操作? - How would I go about performing an operation on closing a C# console application? C# 中的“向后”公钥/私钥加密,我将如何处理 go? - 'Backwards' public/private key encryption in C#, how would I go about this? 我该如何为我的随机数字猜谜游戏C#创建赢数和猜数 - How would i go about creating a win count and guess count for my random number guessing game C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM