TikTok-Api
TikTok-Api copied to clipboard
Added support for statsV2
There is now a statsV2 object that appears to be gradually replacing the original stats object. This patch avoids crashes due to statsV2-only users, and gives priority to statsV2 over stats when both are present.
{
"stats": {"collectCount": 2787, "commentCount": 16000, "diggCount": 22600, "playCount": 1800000, "shareCount": 259}
}
{
"statsV2": {"collectCount": "2787", "commentCount": "15955", "diggCount": "22609", "playCount": "1776621", "shareCount": "259"}
}
I'd like to understand this better. Maybe you could give a small example, with a very abbreviated version of the pandoc types (e.g. with just Str, Emph, Para, and BlockQuote).
As for the application, it's hard for me to see what you're trying to accomplish just from the types you give. I assume you're familiar with our existing Walk module?
Yeah sure, I would be happy to make the example.
OK see https://github.com/jgm/pandoc-types/pull/99
I frequent concern when this sort of thing comes up is breaking downstream code. If that is a concern for you, I am happy to rename the variants and create a bunch of compatibility patterns
https://github.com/obsidiansystems/dombuilder-pandoc/pull/1 shows how I would change the DOM builder to use this. The "prime" functions are not recursive, and thus can be reused to render something like
data MyInline
= Regular (InlineF MyInline) -- fixed typo was `Inline` before
| ReatliveLink Attr [MyInline] MyRoute Text
which would accurately represent a document with checked relative URLs.
Should that be Regular (InlineF MyInline)?
One question is how many changes would be needed to the pandoc code base if pandoc-types were to change in this way. A lot, it seems to me -- but maybe pattern synonyms could be defined that would allow current code to compile?
Should that be
Regular (InlineF MyInline)?
Yes, thanks!
One question is how many changes would be needed to the pandoc code base if pandoc-types were to change in this way. A lot, it seems to me -- but maybe pattern synonyms could be defined that would allow current code to compile?
Indeed. I wanted to wait to hear your thoughts first, but I am happy to write those pattern synonyms and then make the (far more minimal) changes in pandoc too.
Here is a report from another project that saw great utility out of structuring their AST in this way: http://newartisans.com/2018/04/win-for-recursion-schemes/ I thought it would be useful to note here.
Thanks @madeline-os, I was completely blanking on where the existing literature was on this technique.
The one downside I can think off is that the change would make pandoc less accessible to newcomers. However, I believe that this is not as big a problem anymore. Pandoc's code base reflects more and more of the complexity that's inherent to the problems it solves, and this would be just another step in that direction.
I note that the "functorization" could potentially be used to solve jgm/pandoc#684.
OK I created pattern synonyms such that that the PR should be almost breakage free. (Exception is cannot associate data constructors to type synonyms for aliases, which are used for tables.)
Have you tried compiling pandoc against the altered pandoc-types, to see where breakage might happen?
@jgm trying that now.
https://github.com/pandoc/pandoc-lua-marshal/pull/5 https://github.com/jgm/pandoc/pull/8084 are the changes. As you can see are quite minimal and just making some imports uglier because of the GHC deficiency.
Wow, that's quite impressive. I will try to have a closer look at this before long, but it might be a couple weeks.
Sounds good. Just let me know about any and all questions once you do :).
@jgm thanks for giving this another look and repeatedly enabling CI for me.
All 3 PRs:
- https://github.com/jgm/pandoc-types/pull/99
- https://github.com/pandoc/pandoc-lua-marshal/pull/5
- https://github.com/jgm/pandoc/pull/8084
are now passing, anything more you need from me?
Many thanks! I was just waiting for CI to pass before taking a closer look. I'll do that next, but it may be a little while before I can find the time. Don't worry, I haven't forgotten about this.
Sure, sounds good. Take the time you need and thanks for reviewing. Just want to make sure I've gotten everything done on my end, to avoid any "I am waiting on you, you wait on me" deadlock. :)